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>
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index d486dd1..a45d7e0 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -537,7 +537,8 @@
hash_alg = KNOWN_SUPPORTED_HASH_ALG;
alg ^= PSA_ALG_ANY_HASH ^ hash_alg;
#else
- test_fail( "No hash algorithm for hash-and-sign testing", __LINE__, __FILE__ );
+ mbedtls_test_fail( "No hash algorithm for hash-and-sign testing",
+ __LINE__, __FILE__ );
return( 1 );
#endif
}
@@ -997,7 +998,7 @@
mbedtls_snprintf( message, sizeof( message ),
"No sanity check for public key type=0x%08lx",
(unsigned long) type );
- test_fail( message, __LINE__, __FILE__ );
+ mbedtls_test_fail( message, __LINE__, __FILE__ );
(void) p;
(void) end;
return( 0 );
@@ -1111,8 +1112,8 @@
* asymmetric, also check \p psa_export_public_key.
*
* If the key fails the tests, this function calls the test framework's
- * `test_fail` function and returns false. Otherwise this function returns
- * true. Therefore it should be used as follows:
+ * `mbedtls_test_fail` function and returns false. Otherwise this function
+ * returns true. Therefore it should be used as follows:
* ```
* if( ! exercise_key( ... ) ) goto exit;
* ```
@@ -1158,7 +1159,7 @@
mbedtls_snprintf( message, sizeof( message ),
"No code to exercise alg=0x%08lx",
(unsigned long) alg );
- test_fail( message, __LINE__, __FILE__ );
+ mbedtls_test_fail( message, __LINE__, __FILE__ );
ok = 0;
}
@@ -2672,7 +2673,7 @@
/* Compare with corrupted value */
for( i = 0; i < output_length; i++ )
{
- test_set_step( i );
+ mbedtls_test_set_step( i );
output[i] ^= 1;
TEST_EQUAL( psa_hash_compare( alg, input->x, input->len,
output, output_length ),
@@ -3147,7 +3148,7 @@
( output_size >= expected_mac->len ? PSA_SUCCESS :
PSA_ERROR_BUFFER_TOO_SMALL );
- test_set_step( output_size );
+ mbedtls_test_set_step( output_size );
ASSERT_ALLOC( actual_mac, output_size );
/* Calculate the MAC. */
@@ -3233,7 +3234,7 @@
/* Test changing one byte. */
for( size_t i = 0; i < expected_mac->len; i++ )
{
- test_set_step( i );
+ mbedtls_test_set_step( i );
perturbed_mac[i] ^= 1;
PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
PSA_ASSERT( psa_mac_update( &operation,