For tests, rename ASSERT_ALLOC_WEAK() to TEST_CALLOC_OR_SKIP()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
diff --git a/tests/include/test/macros.h b/tests/include/test/macros.h
index 5a7c2e4..1bba436 100644
--- a/tests/include/test/macros.h
+++ b/tests/include/test/macros.h
@@ -161,18 +161,18 @@
* This macro behaves like #TEST_CALLOC_OR_FAIL, except that if the allocation
* fails, it marks the test as skipped rather than failed.
*/
-#define ASSERT_ALLOC_WEAK(pointer, length) \
- do \
- { \
- TEST_ASSERT((pointer) == NULL); \
- if ((length) != 0) \
- { \
- (pointer) = mbedtls_calloc(sizeof(*(pointer)), \
+#define TEST_CALLOC_OR_SKIP(pointer, length) \
+ do { \
+ TEST_ASSERT((pointer) == NULL); \
+ if ((length) != 0) { \
+ (pointer) = mbedtls_calloc(sizeof(*(pointer)), \
(length)); \
- TEST_ASSUME((pointer) != NULL); \
- } \
- } \
- while (0)
+ TEST_ASSUME((pointer) != NULL); \
+ } \
+ } while (0)
+
+/* For backwards compatibility */
+#define ASSERT_ALLOC_WEAK(pointer, length) TEST_CALLOC_OR_SKIP(pointer, length)
/** Compare two buffers and fail the test case if they differ.
*
diff --git a/tests/suites/test_suite_asn1parse.function b/tests/suites/test_suite_asn1parse.function
index 1a16302..9cef8aa 100644
--- a/tests/suites/test_suite_asn1parse.function
+++ b/tests/suites/test_suite_asn1parse.function
@@ -139,7 +139,7 @@
end = buf + 1;
p = end;
} else {
- ASSERT_ALLOC_WEAK(buf, buffer_size);
+ TEST_CALLOC_OR_SKIP(buf, buffer_size);
if (buffer_size > input->len) {
memcpy(buf, input->x, input->len);
memset(buf + input->len, 'A', buffer_size - input->len);
diff --git a/tests/suites/test_suite_ccm.function b/tests/suites/test_suite_ccm.function
index 735c9aa..8e59528 100644
--- a/tests/suites/test_suite_ccm.function
+++ b/tests/suites/test_suite_ccm.function
@@ -48,7 +48,7 @@
mbedtls_ccm_init(&ctx);
- ASSERT_ALLOC_WEAK(add, add_len);
+ TEST_CALLOC_OR_SKIP(add, add_len);
memset(key, 0, sizeof(key));
memset(msg, 0, sizeof(msg));
memset(iv, 0, sizeof(iv));
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 4dda1d7..d2b3c71 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -471,7 +471,7 @@
/* Skip the test case if the target running the test cannot
* accommodate large keys due to heap size constraints */
- ASSERT_ALLOC_WEAK(buffer, buffer_size);
+ TEST_CALLOC_OR_SKIP(buffer, buffer_size);
memset(buffer, 'K', byte_size);
PSA_ASSERT(psa_crypto_init());