From a8a9262de31bb7cfbf89f5f72417de5d7ff4ec48 Mon Sep 17 00:00:00 2001 From: John McNamara Date: Thu, 11 Jun 2015 15:48:56 +0100 Subject: [PATCH] app/test: return error code on failed tests This change returns a system error code if tests fail when running any of the "make test" targets. This allows the tests to report failures while running in continuous integration environments. Previously "make test" returned $? == 0 for all combinations of success, failure and exception conditions. Signed-off-by: John McNamara --- app/test/autotest.py | 4 +++- app/test/autotest_runner.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/test/autotest.py b/app/test/autotest.py index 5d6adb6fec..b9fd6b6f5b 100644 --- a/app/test/autotest.py +++ b/app/test/autotest.py @@ -72,4 +72,6 @@ for test_group in autotest_data.parallel_test_group_list: for test_group in autotest_data.non_parallel_test_group_list: runner.add_non_parallel_test_group(test_group) -runner.run_all_tests() +num_fails = runner.run_all_tests() + +sys.exit(num_fails) diff --git a/app/test/autotest_runner.py b/app/test/autotest_runner.py index 7d28707f95..eadfb7f9a9 100644 --- a/app/test/autotest_runner.py +++ b/app/test/autotest_runner.py @@ -400,9 +400,12 @@ class AutotestRunner: except: print "Exception occured" print sys.exc_info() + self.fails = 1 # drop logs from all executions to a logfile for buf in self.log_buffers: self.logfile.write(buf.replace("\r","")) log_buffers = [] + + return self.fails -- 2.20.1