diff options
author | Gilles Peskine <Gilles.Peskine@arm.com> | 2020-08-29 15:18:23 +0200 |
---|---|---|
committer | Gilles Peskine <Gilles.Peskine@arm.com> | 2020-08-31 10:09:57 +0200 |
commit | 349eadc58faff851ee8dcbb43c702f0ddecfcbb8 (patch) | |
tree | 5721c1ea1ab775b55dd1e3578e01253ad5295772 /tests/suites/helpers.function | |
parent | d4b913385013071a7f4479c833797cb7267e1596 (diff) | |
download | mbedtls-349eadc58faff851ee8dcbb43c702f0ddecfcbb8.zip mbedtls-349eadc58faff851ee8dcbb43c702f0ddecfcbb8.tar.gz mbedtls-349eadc58faff851ee8dcbb43c702f0ddecfcbb8.tar.bz2 |
Report the first failure, not the last one
If test_fail is called multiple times in the same test case, report
the location of the first failure, not the last one.
With this change, you no longer need to take care in tests that use
auxiliary functions not to fail in the main function if the auxiliary
function has failed.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Diffstat (limited to 'tests/suites/helpers.function')
-rw-r--r-- | tests/suites/helpers.function | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function index 7425a35..ec43d13 100644 --- a/tests/suites/helpers.function +++ b/tests/suites/helpers.function @@ -407,6 +407,12 @@ void test_set_step( unsigned long step ) 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; |