Use TEST_FAIL in threaded tests

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
This commit is contained in:
Ryan Everett 2024-03-14 17:50:06 +00:00
parent 6c488709d6
commit 3de040f62d

View File

@ -1370,7 +1370,7 @@ void *thread_import_key(void *ctx)
if (skc->key_loaded) { if (skc->key_loaded) {
mbedtls_mutex_unlock(&skc->key_loaded_mutex); mbedtls_mutex_unlock(&skc->key_loaded_mutex);
/* More than one thread has succeeded, report a failure. */ /* More than one thread has succeeded, report a failure. */
TEST_EQUAL(skc->key_loaded, 0); TEST_FAIL("The same key has been loaded into the key store multiple times.");
} }
skc->key_loaded = 1; skc->key_loaded = 1;
mbedtls_mutex_unlock(&skc->key_loaded_mutex); mbedtls_mutex_unlock(&skc->key_loaded_mutex);
@ -1445,8 +1445,7 @@ void *thread_use_and_destroy_key(void *ctx)
/* Ensure that we are the only thread to succeed. */ /* Ensure that we are the only thread to succeed. */
if (skc->key_loaded != 1) { if (skc->key_loaded != 1) {
mbedtls_mutex_unlock(&skc->key_loaded_mutex); mbedtls_mutex_unlock(&skc->key_loaded_mutex);
//Will always fail TEST_FAIL("The same key has been destroyed multiple times.");
TEST_EQUAL(skc->key_loaded, 1);
} }
skc->key_loaded = 0; skc->key_loaded = 0;
mbedtls_mutex_unlock(&skc->key_loaded_mutex); mbedtls_mutex_unlock(&skc->key_loaded_mutex);