Add an acceptance test for memory usage after handshake

Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Piotr Nowicki 2019-11-26 16:32:40 +01:00 committed by Andrzej Kurek
parent 0afa2a1b65
commit 0937ed29b9
No known key found for this signature in database
GPG key ID: 89A90840DC388527
3 changed files with 126 additions and 2 deletions

View file

@ -1838,7 +1838,10 @@ int main( int argc, char *argv[] )
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof(alloc_buf) );
#endif
#if defined(MBEDTLS_MEMORY_DEBUG)
size_t current_heap_memory, peak_heap_memory, heap_blocks;
#endif /* MBEDTLS_MEMORY_DEBUG */
#endif /* MBEDTLS_MEMORY_BUFFER_ALLOC_C */
/*
* Make sure memory references are valid in case we exit early.
@ -3742,6 +3745,13 @@ handshake:
}
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
#if defined(MBEDTLS_MEMORY_DEBUG)
mbedtls_memory_buffer_alloc_cur_get( &current_heap_memory, &heap_blocks );
mbedtls_memory_buffer_alloc_max_get( &peak_heap_memory, &heap_blocks );
mbedtls_printf( "Heap memory usage after handshake: %lu bytes. Peak memory usage was %lu\n",
(unsigned long) current_heap_memory, (unsigned long) peak_heap_memory );
#endif /* MBEDTLS_MEMORY_DEBUG */
if( opt.exchanges == 0 )
goto close_notify;