Add test_suite_memory_buffer_alloc

This commit is contained in:
Manuel Pégourié-Gonnard 2014-11-27 11:55:27 +01:00 committed by Paul Bakker
parent 5ba1d52f96
commit 765bb31d24
5 changed files with 28 additions and 2 deletions

View File

@ -77,6 +77,7 @@ add_test_suite(hmac_drbg hmac_drbg.pr)
add_test_suite(hmac_shax) add_test_suite(hmac_shax)
add_test_suite(md) add_test_suite(md)
add_test_suite(mdx) add_test_suite(mdx)
add_test_suite(memory_buffer_alloc)
add_test_suite(mpi) add_test_suite(mpi)
add_test_suite(pbkdf2) add_test_suite(pbkdf2)
add_test_suite(pem) add_test_suite(pem)

View File

@ -59,6 +59,7 @@ APPS = test_suite_aes.ecb test_suite_aes.cbc \
test_suite_hmac_drbg.nopr \ test_suite_hmac_drbg.nopr \
test_suite_hmac_drbg.pr \ test_suite_hmac_drbg.pr \
test_suite_md test_suite_mdx \ test_suite_md test_suite_mdx \
test_suite_memory_buffer_alloc \
test_suite_mpi test_suite_pbkdf2 \ test_suite_mpi test_suite_pbkdf2 \
test_suite_pem \ test_suite_pem \
test_suite_pkcs1_v21 test_suite_pkcs5 \ test_suite_pkcs1_v21 test_suite_pkcs5 \
@ -336,6 +337,10 @@ test_suite_mdx: test_suite_mdx.c $(DEP)
echo " CC $@.c" echo " CC $@.c"
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
test_suite_memory_buffer_alloc: test_suite_memory_buffer_alloc.c $(DEP)
echo " CC $@.c"
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
test_suite_mpi: test_suite_mpi.c $(DEP) test_suite_mpi: test_suite_mpi.c $(DEP)
echo " CC $@.c" echo " CC $@.c"
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@ $(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@

View File

@ -211,7 +211,8 @@ int main()
char buf[5000]; char buf[5000];
char *params[50]; char *params[50];
#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
!defined(TEST_SUITE_MEMORY_BUFFER_ALLOC)
unsigned char alloc_buf[1000000]; unsigned char alloc_buf[1000000];
memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) ); memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) );
#endif #endif
@ -298,7 +299,8 @@ int main()
fprintf( stdout, " (%d / %d tests (%d skipped))\n", fprintf( stdout, " (%d / %d tests (%d skipped))\n",
total_tests - total_errors, total_tests, total_skipped ); total_tests - total_errors, total_tests, total_skipped );
#if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C) && \
!defined(TEST_SUITE_MEMORY_BUFFER_ALLOC)
#if defined(POLARSSL_MEMORY_DEBUG) #if defined(POLARSSL_MEMORY_DEBUG)
memory_buffer_alloc_status(); memory_buffer_alloc_status();
#endif #endif

View File

@ -0,0 +1,2 @@
Memory buffer alloc self test
memory_buffer_alloc_self_test:

View File

@ -0,0 +1,16 @@
/* BEGIN_HEADER */
#include <polarssl/memory_buffer_alloc.h>
#define TEST_SUITE_MEMORY_BUFFER_ALLOC
/* END_HEADER */
/* BEGIN_DEPENDENCIES
* depends_on:POLARSSL_MEMORY_BUFFER_ALLOC_C
* END_DEPENDENCIES
*/
/* BEGIN_CASE depends_on:POLARSSL_SELF_TEST */
void memory_buffer_alloc_self_test( )
{
TEST_ASSERT( memory_buffer_alloc_self_test( 0 ) == 0 );
}
/* END_CASE */