Ensure failed test_suite output is sent to stdout

The change modifies the template code in tests/suites/helpers.function
and tests/suites/main.function so that error messages are printed to
stdout instead of being discarded. This makes errors visible regardless
of the --verbose flag being passed or not to the test suite programs.
This commit is contained in:
Andres Amaya Garcia 2017-10-01 16:42:29 +01:00 committed by Simon Butcher
parent 67d8da522f
commit 3f50f511de
2 changed files with 32 additions and 11 deletions

View file

@ -99,7 +99,15 @@ typedef UINT32 uint32_t;
/*----------------------------------------------------------------------------*/
/* Global variables */
static int test_errors = 0;
static struct
{
int failed;
const char *test;
const char *filename;
int line_no;
}
test_info;
/*----------------------------------------------------------------------------*/
@ -395,10 +403,9 @@ static int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len )
static void test_fail( const char *test, int line_no, const char* filename )
{
test_errors++;
if( test_errors == 1 )
mbedtls_fprintf( stdout, "FAILED\n" );
mbedtls_fprintf( stdout, " %s\n at line %d, %s\n", test, line_no,
filename );
test_info.failed = 1;
test_info.test = test;
test_info.line_no = line_no;
test_info.filename = filename;
}