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>
diff --git a/tests/include/test/helpers.h b/tests/include/test/helpers.h
index 8d31048..2ca85d4 100644
--- a/tests/include/test/helpers.h
+++ b/tests/include/test/helpers.h
@@ -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 );
diff --git a/tests/src/helpers.c b/tests/src/helpers.c
index a2f9c3f..9bfd7e0 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -44,7 +44,7 @@
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 @@
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,
diff --git a/tests/suites/host_test.function b/tests/suites/host_test.function
index 872a3a4..b5581b5 100644
--- a/tests/suites/host_test.function
+++ b/tests/suites/host_test.function
@@ -428,15 +428,15 @@
* \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 @@
}
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 @@
}
/* 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 @@
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 @@
// 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 @@
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 @@
}
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 @@
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 );
}
diff --git a/tests/suites/target_test.function b/tests/suites/target_test.function
index 8354b96..7866dcf 100644
--- a/tests/suites/target_test.function
+++ b/tests/suites/target_test.function
@@ -384,8 +384,8 @@
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 @@
if ( ret )
send_failure( ret );
else
- send_status( test_info.result );
+ send_status( mbedtls_test_info.result );
}
return( 0 );
}
diff --git a/tests/suites/test_suite_asn1parse.function b/tests/suites/test_suite_asn1parse.function
index 51cb3ca..75c3fd4 100644
--- a/tests/suites/test_suite_asn1parse.function
+++ b/tests/suites/test_suite_asn1parse.function
@@ -614,7 +614,7 @@
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 );