aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Peskine <gilles.peskine@arm.com>2020-09-05 11:16:02 +0200
committerGitHub <noreply@github.com>2020-09-05 11:16:02 +0200
commitad5c5a27630a7967a7c775da34341a3146a4befd (patch)
tree09f141964d9d99a57d8b424940a79b1e14dbb33e
parent848a4e06b375e067552f1a21d4bc69322c673217 (diff)
parent319ecf3192bce26793f92dd8c3460e878c078d26 (diff)
downloadmbed-tls-ad5c5a27630a7967a7c775da34341a3146a4befd.tar.gz
Merge pull request #3626 from gilles-peskine-arm/test-fail-report-first-2.16
Backport 2.16: Report the first unit test failure, not the last one
-rw-r--r--tests/suites/helpers.function6
-rw-r--r--tests/suites/test_suite_mpi.function2
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index 4f46ea967..d684ca334 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -382,6 +382,12 @@ jmp_buf jmp_tmp;
void test_fail( const char *test, int line_no, const char* filename )
{
+ if( test_info.result == TEST_RESULT_FAILED )
+ {
+ /* We've already recorded the test as having failed. Don't
+ * overwrite any previous information about the failure. */
+ return;
+ }
test_info.result = TEST_RESULT_FAILED;
test_info.test = test;
test_info.line_no = line_no;
diff --git a/tests/suites/test_suite_mpi.function b/tests/suites/test_suite_mpi.function
index f2702f12b..e5e03bbd2 100644
--- a/tests/suites/test_suite_mpi.function
+++ b/tests/suites/test_suite_mpi.function
@@ -542,7 +542,7 @@ void mbedtls_mpi_lt_mpi_ct( int size_X, char * input_X,
int size_Y, char * input_Y,
int input_ret, int input_err )
{
- unsigned ret;
+ unsigned ret = -1;
unsigned input_uret = input_ret;
mbedtls_mpi X, Y;
mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );