Ensure ops are tested on successful 'fail' tests
Make sure the number of ops is tested in the interruptible failure tests,
should they get through the interruptible loop part.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index aaf9d86..d89afa3 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -6642,13 +6642,8 @@
num_completes++;
- /* If the psa_sign_hash_start() failed, psa_sign_hash_complete()
- * should also fail with bad state. */
- if (expected_start_status != PSA_SUCCESS) {
- TEST_EQUAL(actual_status, PSA_ERROR_BAD_STATE);
- } else if (actual_status != PSA_OPERATION_INCOMPLETE) {
- TEST_EQUAL(actual_status, expected_complete_status);
- } else {
+ if (actual_status == PSA_SUCCESS ||
+ actual_status == PSA_OPERATION_INCOMPLETE) {
num_ops = psa_sign_hash_get_num_ops(&operation);
TEST_ASSERT(num_ops > num_ops_prior);
@@ -6656,6 +6651,14 @@
}
} while (actual_status == PSA_OPERATION_INCOMPLETE);
+ /* If the psa_sign_hash_start() failed, psa_sign_hash_complete()
+ * should also fail with bad state. */
+ if (expected_start_status != PSA_SUCCESS) {
+ TEST_EQUAL(actual_status, PSA_ERROR_BAD_STATE);
+ } else if (actual_status != PSA_OPERATION_INCOMPLETE) {
+ TEST_EQUAL(actual_status, expected_complete_status);
+ }
+
PSA_ASSERT(psa_sign_hash_abort(&operation));
num_ops = psa_sign_hash_get_num_ops(&operation);
@@ -7067,13 +7070,8 @@
num_completes++;
- /* If the psa_verify_hash_start() failed,
- * psa_verify_hash_complete() should also fail with bad state.*/
- if (expected_start_status != PSA_SUCCESS) {
- TEST_EQUAL(actual_status, PSA_ERROR_BAD_STATE);
- } else if (actual_status != PSA_OPERATION_INCOMPLETE) {
- TEST_EQUAL(actual_status, expected_complete_status);
- } else {
+ if (actual_status == PSA_SUCCESS ||
+ actual_status == PSA_OPERATION_INCOMPLETE) {
num_ops = psa_verify_hash_get_num_ops(&operation);
TEST_ASSERT(num_ops > num_ops_prior);
@@ -7081,6 +7079,14 @@
}
} while (actual_status == PSA_OPERATION_INCOMPLETE);
+ /* If the psa_verify_hash_start() failed,
+ * psa_verify_hash_complete() should also fail with bad state.*/
+ if (expected_start_status != PSA_SUCCESS) {
+ TEST_EQUAL(actual_status, PSA_ERROR_BAD_STATE);
+ } else if (actual_status != PSA_OPERATION_INCOMPLETE) {
+ TEST_EQUAL(actual_status, expected_complete_status);
+ }
+
TEST_LE_U(min_completes, num_completes);
TEST_LE_U(num_completes, max_completes);