From dc28a5a10537da96d2e0da524c3490f7305bb16f Mon Sep 17 00:00:00 2001 From: Agathiyan Bragadeesh Date: Tue, 18 Jul 2023 11:45:28 +0100 Subject: [PATCH] Rename ASSERT_FALSE to TEST_FAIL Signed-off-by: Agathiyan Bragadeesh --- tests/include/test/macros.h | 2 +- tests/src/psa_exercise_key.c | 8 ++++---- tests/src/test_helpers/ssl_helpers.c | 2 +- tests/suites/test_suite_alignment.function | 2 +- tests/suites/test_suite_asn1write.function | 2 +- tests/suites/test_suite_psa_crypto.function | 6 +++--- .../suites/test_suite_psa_crypto_driver_wrappers.function | 4 ++-- tests/suites/test_suite_psa_crypto_se_driver_hal.function | 2 +- .../suites/test_suite_psa_crypto_slot_management.function | 2 +- tests/suites/test_suite_shax.function | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/include/test/macros.h b/tests/include/test/macros.h index 4d8802909..6ddcb4c85 100644 --- a/tests/include/test/macros.h +++ b/tests/include/test/macros.h @@ -65,7 +65,7 @@ * * \param MESSAGE The message to be outputed on assertion */ -#define ASSERT_FALSE(MESSAGE) \ +#define TEST_FAIL(MESSAGE) \ do { \ mbedtls_test_fail(MESSAGE, __LINE__, __FILE__); \ goto exit; \ diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c index fb4a2ce14..c32eca843 100644 --- a/tests/src/psa_exercise_key.c +++ b/tests/src/psa_exercise_key.c @@ -309,7 +309,7 @@ static int exercise_signature_key(mbedtls_svc_key_id_t key, hash_alg = KNOWN_SUPPORTED_HASH_ALG; alg ^= PSA_ALG_ANY_HASH ^ hash_alg; #else - ASSERT_FALSE("No hash algorithm for hash-and-sign testing"); + TEST_FAIL("No hash algorithm for hash-and-sign testing"); #endif } @@ -438,7 +438,7 @@ int mbedtls_test_psa_setup_key_derivation_wrap( PSA_KEY_DERIVATION_INPUT_LABEL, input2, input2_length)); } else { - ASSERT_FALSE("Key derivation algorithm not supported"); + TEST_FAIL("Key derivation algorithm not supported"); } if (capacity != SIZE_MAX) { @@ -798,7 +798,7 @@ int mbedtls_test_psa_exported_key_sanity_check( PSA_EXPORT_PUBLIC_KEY_MAX_SIZE); } else { (void) exported; - ASSERT_FALSE("Sanity check not implemented for this key type"); + TEST_FAIL("Sanity check not implemented for this key type"); } #if defined(MBEDTLS_DES_C) @@ -943,7 +943,7 @@ int mbedtls_test_psa_exercise_key(mbedtls_svc_key_id_t key, } else if (PSA_ALG_IS_KEY_AGREEMENT(alg)) { ok = exercise_key_agreement_key(key, usage, alg); } else { - ASSERT_FALSE("No code to exercise this category of algorithm"); + TEST_FAIL("No code to exercise this category of algorithm"); } ok = ok && exercise_export_key(key, usage); diff --git a/tests/src/test_helpers/ssl_helpers.c b/tests/src/test_helpers/ssl_helpers.c index fd13451c1..f1eb1a02e 100644 --- a/tests/src/test_helpers/ssl_helpers.c +++ b/tests/src/test_helpers/ssl_helpers.c @@ -1753,7 +1753,7 @@ static int check_ssl_version( break; default: - ASSERT_FALSE( + TEST_FAIL( "Version check not implemented for this protocol version"); } diff --git a/tests/suites/test_suite_alignment.function b/tests/suites/test_suite_alignment.function index 96aef8163..e5ccd7539 100644 --- a/tests/suites/test_suite_alignment.function +++ b/tests/suites/test_suite_alignment.function @@ -121,7 +121,7 @@ void mbedtls_byteswap(char *input_str, int size, char *expected_str) r = MBEDTLS_BSWAP64(input); break; default: - ASSERT_FALSE("size must be 16, 32 or 64"); + TEST_FAIL("size must be 16, 32 or 64"); } TEST_EQUAL(r, expected); diff --git a/tests/suites/test_suite_asn1write.function b/tests/suites/test_suite_asn1write.function index 28803b62b..3d08920ba 100644 --- a/tests/suites/test_suite_asn1write.function +++ b/tests/suites/test_suite_asn1write.function @@ -316,7 +316,7 @@ void mbedtls_asn1_write_algorithm_identifier(data_t *oid, buf_complete[data_len + 2] = (unsigned char) (expected_params_len >> 8); buf_complete[data_len + 3] = (unsigned char) (expected_params_len); } else { - ASSERT_FALSE("Bad test data: invalid length of ASN.1 element"); + TEST_FAIL("Bad test data: invalid length of ASN.1 element"); } unsigned char *p = buf_complete; TEST_EQUAL(mbedtls_asn1_get_alg(&p, end_complete, diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index eb496033e..8fb328c2d 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -8780,7 +8780,7 @@ void derive_output(int alg_arg, } break; default: - ASSERT_FALSE("default case not supported"); + TEST_FAIL("default case not supported"); break; } break; @@ -8830,7 +8830,7 @@ void derive_output(int alg_arg, key_agreement_peer_key->len), statuses[i]); break; default: - ASSERT_FALSE("default case not supported"); + TEST_FAIL("default case not supported"); break; } @@ -9822,7 +9822,7 @@ void persistent_key_load_key_from_storage(data_t *data, break; default: - ASSERT_FALSE("generation_method not implemented in test"); + TEST_FAIL("generation_method not implemented in test"); break; } psa_reset_key_attributes(&attributes); diff --git a/tests/suites/test_suite_psa_crypto_driver_wrappers.function b/tests/suites/test_suite_psa_crypto_driver_wrappers.function index 026592e8f..2b1fad1d1 100644 --- a/tests/suites/test_suite_psa_crypto_driver_wrappers.function +++ b/tests/suites/test_suite_psa_crypto_driver_wrappers.function @@ -465,7 +465,7 @@ static int sanity_check_rsa_encryption_result( TEST_EQUAL(buf[0], 0x00); /* The rest is too hard to check */ } else { - ASSERT_FALSE("Encryption result sanity check not implemented for RSA algorithm"); + TEST_FAIL("Encryption result sanity check not implemented for RSA algorithm"); } #endif /* MBEDTLS_BIGNUM_C */ @@ -2754,7 +2754,7 @@ void asymmetric_encrypt(int alg_arg, { (void) modulus; (void) private_exponent; - ASSERT_FALSE("Encryption sanity checks not implemented for this key type"); + TEST_FAIL("Encryption sanity checks not implemented for this key type"); } } } diff --git a/tests/suites/test_suite_psa_crypto_se_driver_hal.function b/tests/suites/test_suite_psa_crypto_se_driver_hal.function index 08ab13bf1..5c9fc2760 100644 --- a/tests/suites/test_suite_psa_crypto_se_driver_hal.function +++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.function @@ -1328,7 +1328,7 @@ void sign_verify(int flow, key_management.p_export_public = ram_export_public; break; default: - ASSERT_FALSE("unsupported flow (should be SIGN_IN_xxx)"); + TEST_FAIL("unsupported flow (should be SIGN_IN_xxx)"); break; } asymmetric.p_verify = ram_verify; diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function index c3f3f53ac..905be03ea 100644 --- a/tests/suites/test_suite_psa_crypto_slot_management.function +++ b/tests/suites/test_suite_psa_crypto_slot_management.function @@ -775,7 +775,7 @@ void invalid_handle(int handle_construction, mbedtls_svc_key_id_make(0, PSA_KEY_ID_VENDOR_MAX + 1); break; default: - ASSERT_FALSE("unknown handle construction"); + TEST_FAIL("unknown handle construction"); } /* Attempt to use the invalid handle. */ diff --git a/tests/suites/test_suite_shax.function b/tests/suites/test_suite_shax.function index 6320855fd..f68c3e95a 100644 --- a/tests/suites/test_suite_shax.function +++ b/tests/suites/test_suite_shax.function @@ -275,14 +275,14 @@ void sha3_reuse(data_t *input1, data_t *hash1, case 32: type1 = MBEDTLS_SHA3_256; break; case 48: type1 = MBEDTLS_SHA3_384; break; case 64: type1 = MBEDTLS_SHA3_512; break; - default: ASSERT_FALSE("hash1->len validity"); break; + default: TEST_FAIL("hash1->len validity"); break; } switch (hash2->len) { case 28: type2 = MBEDTLS_SHA3_224; break; case 32: type2 = MBEDTLS_SHA3_256; break; case 48: type2 = MBEDTLS_SHA3_384; break; case 64: type2 = MBEDTLS_SHA3_512; break; - default: ASSERT_FALSE("hash2->len validity"); break; + default: TEST_FAIL("hash2->len validity"); break; } /* Round 1 */