mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 12:15:38 +01:00
New test suite: net
A place to put tests for the net_sockets module (MBEDTLS_NET_C feature). Start with a context smoke test. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
2ac5f8c04b
commit
1c0e48a2ce
@ -134,6 +134,7 @@ add_test_suite(md)
|
||||
add_test_suite(mdx)
|
||||
add_test_suite(memory_buffer_alloc)
|
||||
add_test_suite(mpi)
|
||||
add_test_suite(net)
|
||||
add_test_suite(nist_kw)
|
||||
add_test_suite(oid)
|
||||
add_test_suite(pem)
|
||||
|
6
tests/suites/test_suite_net.data
Normal file
6
tests/suites/test_suite_net.data
Normal file
@ -0,0 +1,6 @@
|
||||
Context init-free-free
|
||||
context_init_free:0
|
||||
|
||||
Context init-free-init-free
|
||||
context_init_free:1
|
||||
|
28
tests/suites/test_suite_net.function
Normal file
28
tests/suites/test_suite_net.function
Normal file
@ -0,0 +1,28 @@
|
||||
/* BEGIN_HEADER */
|
||||
|
||||
#include "mbedtls/net_sockets.h"
|
||||
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
* depends_on:MBEDTLS_NET_C
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void context_init_free( int reinit )
|
||||
{
|
||||
mbedtls_net_context ctx;
|
||||
|
||||
mbedtls_net_init( &ctx );
|
||||
mbedtls_net_free( &ctx );
|
||||
|
||||
if( reinit )
|
||||
mbedtls_net_init( &ctx );
|
||||
mbedtls_net_free( &ctx );
|
||||
|
||||
/* This test case always succeeds, functionally speaking. A plausible
|
||||
* bug might trigger an invalid pointer dereference or a memory leak. */
|
||||
goto exit;
|
||||
}
|
||||
/* END_CASE */
|
Loading…
Reference in New Issue
Block a user