From 86cadb37d1869e022f8b0ac4e95b6c22be33aeb1 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 24 Nov 2020 17:49:31 +0100 Subject: [PATCH] Remove now-redundant test result check Since 349eadc58faff851ee8dcbb43c702f0ddecfcbb8, test_fail() reports the first failure. So it's safe to call test_fail() again to report a cleanup failure when we don't want to potentially erase information about an earlier failure. The behavior of mbedtls_test_helper_is_psa_pristine() changes if test_info.result was neither TEST_RESULT_SUCCESS nor TEST_RESULT_FAILED, but this should not matter since a skipped test should not cause mbedtls_test_helper_is_psa_pristine() to fail. Signed-off-by: Gilles Peskine --- tests/include/test/psa_crypto_helpers.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h index 9263a932c..e62bc0401 100644 --- a/tests/include/test/psa_crypto_helpers.h +++ b/tests/include/test/psa_crypto_helpers.h @@ -46,10 +46,7 @@ static int mbedtls_test_helper_is_psa_pristine( int line, const char *file ) msg = "Some slots are still marked as locked."; } - /* If the test has already failed, don't overwrite the failure - * information. Do keep the stats lookup above, because it can be - * convenient to break on it when debugging a failure. */ - if( msg != NULL && test_info.result == TEST_RESULT_SUCCESS ) + if( msg != NULL ) test_fail( msg, line, file ); return( msg == NULL );