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:
Chris Jones 2021-01-20 15:56:42 +00:00
parent 1be34dafab
commit 9634bb10d9
9 changed files with 98 additions and 89 deletions

View file

@ -49,9 +49,41 @@
#include <stddef.h>
#include <stdint.h>
typedef enum
{
TEST_RESULT_SUCCESS = 0,
TEST_RESULT_FAILED,
TEST_RESULT_SKIPPED
} test_result_t;
typedef struct
{
test_result_t result;
const char *test;
const char *filename;
int line_no;
unsigned long step;
}
test_info_t;
extern test_info_t test_info;
int mbedtls_test_platform_setup( void );
void mbedtls_test_platform_teardown( void );
void mbedtls_test_fail( const char *test, int line_no, const char* filename );
/** Set the test step number for failure reports.
*
* Call this function to display "step NNN" in addition to the line number
* and file name if a test fails. Typically the "step number" is the index
* of a for loop but it can be whatever you want.
*
* \param step The step number to report.
*/
void mbedtls_test_set_step( unsigned long step );
void mbedtls_test_skip( const char *test, int line_no, const char* filename );
/**
* \brief This function decodes the hexadecimal representation of
* data.