1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Add debug_set_threshold() and thresholding of messages

This commit is contained in:
Paul Bakker
2014-04-25 16:34:30 +02:00
parent 92478c37a6
commit c73079a78c
9 changed files with 107 additions and 34 deletions

View File

@ -29,6 +29,28 @@ void string_debug(void *data, int level, const char *str)
* END_DEPENDENCIES
*/
/* BEGIN_CASE */
void debug_print_msg_threshold( int threshold, int level, char *file, int line,
char *result_str )
{
ssl_context ssl;
struct buffer_data buffer;
memset( &ssl, 0, sizeof( ssl_context ) );
memset( buffer.buf, 0, 2000 );
buffer.ptr = buffer.buf;
debug_set_log_mode( POLARSSL_DEBUG_LOG_FULL );
debug_set_threshold( threshold );
ssl_set_dbg(&ssl, string_debug, &buffer);
debug_print_msg( &ssl, level, file, line,
debug_fmt("Text message, 2 == %d", 2 ) );
TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE */
void debug_print_ret( int mode, char *file, int line, char *text, int value,
char *result_str )