From 0174be2c1723952487026cabfefaaad75b08756a Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 17 Dec 2018 23:26:01 +0100 Subject: [PATCH] Move the PSA_ASSERT macro to the common helpers file It's potentially useful in all PSA test suites, of which there are now several. --- tests/suites/helpers.function | 8 ++++++++ .../suites/test_suite_psa_crypto_slot_management.function | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 4a9d2a3bb..316c06e31 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -90,6 +90,14 @@ typedef struct data_tag } \ } while( 0 ) +/** Evaluate an expression and fail the test case if it returns an error. + * + * \param expr The expression to evaluate. This is typically a call + * to a \c psa_xxx function that returns a value of type + * #psa_status_t. + */ +#define PSA_ASSERT( expr ) TEST_ASSERT( ( expr ) == PSA_SUCCESS ) + /** Allocate memory dynamically and fail the test case if this fails. * * You must set \p pointer to \c NULL before calling this macro and diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function index fdcb5a949..407d24b1c 100644 --- a/tests/suites/test_suite_psa_crypto_slot_management.function +++ b/tests/suites/test_suite_psa_crypto_slot_management.function @@ -8,8 +8,6 @@ #include "psa_crypto_storage.h" -#define PSA_ASSERT( expr ) TEST_ASSERT( ( expr ) == PSA_SUCCESS ) - typedef enum { CLOSE_BY_CLOSE,