From 20273ddc4c4b0ea0502be83d0b896d442d469562 Mon Sep 17 00:00:00 2001 From: SimonB Date: Mon, 2 May 2016 21:32:44 +0100 Subject: [PATCH] Adds reporting of file/line no. in failed tests Tests in tests/suites will now report the file and line number of failed test assertions. --- tests/suites/helpers.function | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 8521b878c..aa8a0456c 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -59,7 +59,7 @@ typedef UINT32 uint32_t; do { \ if( ! (TEST) ) \ { \ - test_fail( #TEST ); \ + test_fail( #TEST, __LINE__, __FILE__ ); \ goto exit; \ } \ } while( 0 ) @@ -350,11 +350,11 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len ) return( 0 ); } -static void test_fail( const char *test ) +static void test_fail( const char *test, int line_no, char* filename ) { test_errors++; if( test_errors == 1 ) mbedtls_printf( "FAILED\n" ); - mbedtls_printf( " %s\n", test ); + mbedtls_printf( " %s\n at line %d, %s\n", test, line_no, filename ); }