mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-10-24 13:32:59 +03:00
Move helper testing functions to tests/src/helpers.c
Moves the functions `test_fail`, `test_set_step`, `test_skip` and the struct `test_info` from `tests/suites/helpers.function` to `tests/src/helpers.*`. This is done to open these functions up to the API where they can be used by other functions in the 'src' test infrastructure module. As the functions are now contained within the src folder of the testing infrastructure, the `mbedtls_` prefix has been added to the functions. Signed-off-by: Chris Jones <christopher.jones@arm.com>
This commit is contained in:
@@ -44,6 +44,8 @@ static param_failed_ctx_t param_failed_ctx;
|
||||
static mbedtls_platform_context platform_ctx;
|
||||
#endif
|
||||
|
||||
test_info_t test_info;
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
|
||||
@@ -77,6 +79,33 @@ static int ascii2uc(const char c, unsigned char *uc)
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
void mbedtls_test_fail( const char *test, int line_no, const char* filename )
|
||||
{
|
||||
if( test_info.result == TEST_RESULT_FAILED )
|
||||
{
|
||||
/* We've already recorded the test as having failed. Don't
|
||||
* overwrite any previous information about the failure. */
|
||||
return;
|
||||
}
|
||||
test_info.result = TEST_RESULT_FAILED;
|
||||
test_info.test = test;
|
||||
test_info.line_no = line_no;
|
||||
test_info.filename = filename;
|
||||
}
|
||||
|
||||
void mbedtls_test_set_step( unsigned long step )
|
||||
{
|
||||
test_info.step = step;
|
||||
}
|
||||
|
||||
void mbedtls_test_skip( const char *test, int line_no, const char* filename )
|
||||
{
|
||||
test_info.result = TEST_RESULT_SKIPPED;
|
||||
test_info.test = test;
|
||||
test_info.line_no = line_no;
|
||||
test_info.filename = filename;
|
||||
}
|
||||
|
||||
int mbedtls_test_unhexify( unsigned char *obuf,
|
||||
size_t obufmax,
|
||||
const char *ibuf,
|
||||
|
||||
Reference in New Issue
Block a user