mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 04:15:43 +01:00
Add mbedtls_
prefix to all public names in helpers.h
Adds the `mbedtls_` prefix to `test_result_t` and `test_info` and updates any references to them. This is to follow the naming convention as these are now declared in a public namespace. Signed-off-by: Chris Jones <christopher.jones@arm.com>
This commit is contained in:
parent
9634bb10d9
commit
e60e2aeb74
@ -51,21 +51,21 @@
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TEST_RESULT_SUCCESS = 0,
|
||||
TEST_RESULT_FAILED,
|
||||
TEST_RESULT_SKIPPED
|
||||
} test_result_t;
|
||||
MBEDTLS_TEST_RESULT_SUCCESS = 0,
|
||||
MBEDTLS_TEST_RESULT_FAILED,
|
||||
MBEDTLS_TEST_RESULT_SKIPPED
|
||||
} mbedtls_test_result_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
test_result_t result;
|
||||
mbedtls_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;
|
||||
mbedtls_test_info_t;
|
||||
extern mbedtls_test_info_t mbedtls_test_info;
|
||||
|
||||
int mbedtls_test_platform_setup( void );
|
||||
void mbedtls_test_platform_teardown( void );
|
||||
|
@ -44,7 +44,7 @@ static param_failed_ctx_t param_failed_ctx;
|
||||
static mbedtls_platform_context platform_ctx;
|
||||
#endif
|
||||
|
||||
test_info_t test_info;
|
||||
mbedtls_test_info_t mbedtls_test_info;
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Helper Functions */
|
||||
@ -81,29 +81,29 @@ static int ascii2uc(const char c, unsigned char *uc)
|
||||
|
||||
void mbedtls_test_fail( const char *test, int line_no, const char* filename )
|
||||
{
|
||||
if( test_info.result == TEST_RESULT_FAILED )
|
||||
if( mbedtls_test_info.result == MBEDTLS_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;
|
||||
mbedtls_test_info.result = MBEDTLS_TEST_RESULT_FAILED;
|
||||
mbedtls_test_info.test = test;
|
||||
mbedtls_test_info.line_no = line_no;
|
||||
mbedtls_test_info.filename = filename;
|
||||
}
|
||||
|
||||
void mbedtls_test_set_step( unsigned long step )
|
||||
{
|
||||
test_info.step = step;
|
||||
mbedtls_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;
|
||||
mbedtls_test_info.result = MBEDTLS_TEST_RESULT_SKIPPED;
|
||||
mbedtls_test_info.test = test;
|
||||
mbedtls_test_info.line_no = line_no;
|
||||
mbedtls_test_info.filename = filename;
|
||||
}
|
||||
|
||||
int mbedtls_test_unhexify( unsigned char *obuf,
|
||||
|
@ -428,15 +428,15 @@ static void write_outcome_entry( FILE *outcome_file,
|
||||
* \param unmet_dependencies The array of unmet dependencies.
|
||||
* \param missing_unmet_dependencies Non-zero if there was a problem tracking
|
||||
* all unmet dependencies, 0 otherwise.
|
||||
* \param ret The test dispatch status (DISPATCH_xxx).
|
||||
* \param test_info A pointer to the test info structure.
|
||||
* \param ret The test dispatch status (DISPATCH_xxx).
|
||||
* \param mbedtls_test_info A pointer to the test info structure.
|
||||
*/
|
||||
static void write_outcome_result( FILE *outcome_file,
|
||||
size_t unmet_dep_count,
|
||||
int unmet_dependencies[],
|
||||
int missing_unmet_dependencies,
|
||||
int ret,
|
||||
const test_info_t *info )
|
||||
const mbedtls_test_info_t *info )
|
||||
{
|
||||
if( outcome_file == NULL )
|
||||
return;
|
||||
@ -462,10 +462,10 @@ static void write_outcome_result( FILE *outcome_file,
|
||||
}
|
||||
switch( info->result )
|
||||
{
|
||||
case TEST_RESULT_SUCCESS:
|
||||
case MBEDTLS_TEST_RESULT_SUCCESS:
|
||||
mbedtls_fprintf( outcome_file, "PASS;" );
|
||||
break;
|
||||
case TEST_RESULT_SKIPPED:
|
||||
case MBEDTLS_TEST_RESULT_SKIPPED:
|
||||
mbedtls_fprintf( outcome_file, "SKIP;Runtime skip" );
|
||||
break;
|
||||
default:
|
||||
@ -601,7 +601,7 @@ int execute_tests( int argc , const char ** argv )
|
||||
}
|
||||
|
||||
/* Initialize the struct that holds information about the last test */
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
memset( &mbedtls_test_info, 0, sizeof( mbedtls_test_info ) );
|
||||
|
||||
/* Now begin to execute the tests in the testfiles */
|
||||
for ( testfile_index = 0;
|
||||
@ -638,7 +638,8 @@ int execute_tests( int argc , const char ** argv )
|
||||
if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
|
||||
break;
|
||||
mbedtls_fprintf( stdout, "%s%.66s",
|
||||
test_info.result == TEST_RESULT_FAILED ? "\n" : "", buf );
|
||||
mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED ?
|
||||
"\n" : "", buf );
|
||||
mbedtls_fprintf( stdout, " " );
|
||||
for( i = strlen( buf ) + 1; i < 67; i++ )
|
||||
mbedtls_fprintf( stdout, "." );
|
||||
@ -682,8 +683,8 @@ int execute_tests( int argc , const char ** argv )
|
||||
// If there are no unmet dependencies execute the test
|
||||
if( unmet_dep_count == 0 )
|
||||
{
|
||||
test_info.result = TEST_RESULT_SUCCESS;
|
||||
test_info.step = (unsigned long)( -1 );
|
||||
mbedtls_test_info.result = MBEDTLS_TEST_RESULT_SUCCESS;
|
||||
mbedtls_test_info.step = (unsigned long)( -1 );
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
/* Suppress all output from the library unless we're verbose
|
||||
@ -723,7 +724,7 @@ int execute_tests( int argc , const char ** argv )
|
||||
write_outcome_result( outcome_file,
|
||||
unmet_dep_count, unmet_dependencies,
|
||||
missing_unmet_dependencies,
|
||||
ret, &test_info );
|
||||
ret, &mbedtls_test_info );
|
||||
if( unmet_dep_count > 0 || ret == DISPATCH_UNSUPPORTED_SUITE )
|
||||
{
|
||||
total_skipped++;
|
||||
@ -753,11 +754,11 @@ int execute_tests( int argc , const char ** argv )
|
||||
}
|
||||
else if( ret == DISPATCH_TEST_SUCCESS )
|
||||
{
|
||||
if( test_info.result == TEST_RESULT_SUCCESS )
|
||||
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_SUCCESS )
|
||||
{
|
||||
mbedtls_fprintf( stdout, "PASS\n" );
|
||||
}
|
||||
else if( test_info.result == TEST_RESULT_SKIPPED )
|
||||
else if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_SKIPPED )
|
||||
{
|
||||
mbedtls_fprintf( stdout, "----\n" );
|
||||
total_skipped++;
|
||||
@ -767,14 +768,15 @@ int execute_tests( int argc , const char ** argv )
|
||||
total_errors++;
|
||||
mbedtls_fprintf( stdout, "FAILED\n" );
|
||||
mbedtls_fprintf( stdout, " %s\n at ",
|
||||
test_info.test );
|
||||
if( test_info.step != (unsigned long)( -1 ) )
|
||||
mbedtls_test_info.test );
|
||||
if( mbedtls_test_info.step != (unsigned long)( -1 ) )
|
||||
{
|
||||
mbedtls_fprintf( stdout, "step %lu, ",
|
||||
test_info.step );
|
||||
mbedtls_test_info.step );
|
||||
}
|
||||
mbedtls_fprintf( stdout, "line %d, %s",
|
||||
test_info.line_no, test_info.filename );
|
||||
mbedtls_test_info.line_no,
|
||||
mbedtls_test_info.filename );
|
||||
}
|
||||
fflush( stdout );
|
||||
}
|
||||
|
@ -384,8 +384,8 @@ int execute_tests( int args, const char ** argv )
|
||||
while ( 1 )
|
||||
{
|
||||
ret = 0;
|
||||
test_info.result = TEST_RESULT_SUCCESS;
|
||||
test_info.step = (unsigned long)( -1 );
|
||||
mbedtls_test_info.result = MBEDTLS_TEST_RESULT_SUCCESS;
|
||||
mbedtls_test_info.step = (unsigned long)( -1 );
|
||||
data_len = 0;
|
||||
|
||||
data = receive_data( &data_len );
|
||||
@ -443,7 +443,7 @@ int execute_tests( int args, const char ** argv )
|
||||
if ( ret )
|
||||
send_failure( ret );
|
||||
else
|
||||
send_status( test_info.result );
|
||||
send_status( mbedtls_test_info.result );
|
||||
}
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ void get_sequence_of( const data_t *input, int tag,
|
||||
cur = &head;
|
||||
while( *rest )
|
||||
{
|
||||
++test_info.step;
|
||||
++mbedtls_test_info.step;
|
||||
TEST_ASSERT( cur != NULL );
|
||||
TEST_EQUAL( cur->buf.tag, tag );
|
||||
n = strtoul( rest, (char **) &rest, 0 );
|
||||
|
Loading…
Reference in New Issue
Block a user