aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Peskine <gilles.peskine@arm.com>2020-09-05 11:16:08 +0200
committerGitHub <noreply@github.com>2020-09-05 11:16:08 +0200
commit75ffb2757799b00d86f06679b2dfec4529f79739 (patch)
tree7d7c50c85620d10af1d7bf7d76b8b46caed96110
parent7cd4d2dadb5fdc8410ee667f062646bd28f37e62 (diff)
parentcb0ec05717c935e29a3c35a72bbbaf8ba1f51bf8 (diff)
downloadmbed-tls-75ffb2757799b00d86f06679b2dfec4529f79739.tar.gz
Merge pull request #3627 from gilles-peskine-arm/test-fail-report-first-2.7
Backport 2.7: 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 c1c76ec09..7aa614ab8 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -211,6 +211,12 @@ test_info;
void test_fail( const char *test, int line_no, const char* filename )
{
+ if( test_info.failed )
+ {
+ /* We've already recorded the test as having failed. Don't
+ * overwrite any previous information about the failure. */
+ return;
+ }
test_info.failed = 1;
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 6f5abf3b8..d023466eb 100644
--- a/tests/suites/test_suite_mpi.function
+++ b/tests/suites/test_suite_mpi.function
@@ -337,7 +337,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 );