mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-28 08:37:25 +00:00
Make mbedtls_test_err_add_check fail tests
Previously an error message was printed and then the test manually exited via `mbedtls_exit( 1 )`. This commit includes a rebase onto: 540320bf7b5de6d3dbd78abb3e5527674189d09c so that `mbedtls_test_fail` can be used instead to properly fail tests (and report them as such). Signed-off-by: Chris Jones <christopher.jones@arm.com>
This commit is contained in:
parent
d86ad60aa5
commit
fe285f53e6
@ -289,33 +289,25 @@ void mbedtls_test_err_add_check( int high, int low,
|
||||
{
|
||||
if ( high > -0x1000 )
|
||||
{
|
||||
mbedtls_fprintf( stderr, "\n'high' is not a high-level error code - "
|
||||
"%s:%d\n", file, line );
|
||||
mbedtls_exit( 1 );
|
||||
mbedtls_test_fail( "'high' is not a high-level error code",
|
||||
line, file );
|
||||
}
|
||||
else if ( high < -0x7F80 )
|
||||
{
|
||||
mbedtls_fprintf( stderr, "\n'high' is greater than 16-bits - "
|
||||
"%s:%d\n", file, line );
|
||||
mbedtls_exit( 1 );
|
||||
mbedtls_test_fail( "'high' is greater than 16-bits", line, file );
|
||||
}
|
||||
else if ( ( high & 0x7F ) != 0 )
|
||||
{
|
||||
mbedtls_fprintf( stderr, "\n'high' contains a low-level error code - "
|
||||
"%s:%d\n", file, line );
|
||||
mbedtls_exit( 1 );
|
||||
mbedtls_test_fail( "'high' contains a low-level error code",
|
||||
line, file );
|
||||
}
|
||||
else if ( low < -0x007F )
|
||||
{
|
||||
mbedtls_fprintf( stderr, "\n'low' is greater than 8-bits - "
|
||||
"%s:%d\n", file, line );
|
||||
mbedtls_exit( 1 );
|
||||
mbedtls_test_fail( "'low' is greater than 8-bits", line, file );
|
||||
}
|
||||
else if ( low > 0 )
|
||||
{
|
||||
mbedtls_fprintf( stderr, "\n'low' is zero or greater - "
|
||||
"%s:%d\n", file, line );
|
||||
mbedtls_exit( 1 );
|
||||
mbedtls_test_fail( "'low' is zero or greater", line, file );
|
||||
}
|
||||
}
|
||||
#endif /* MBEDTLS_TEST_HOOKS */
|
||||
|
Loading…
x
Reference in New Issue
Block a user