]> git.droids-corp.org - dpdk.git/commitdiff
app/test: return error code on failed tests
authorJohn McNamara <john.mcnamara@intel.com>
Thu, 11 Jun 2015 14:48:56 +0000 (15:48 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 15 Jun 2015 13:17:52 +0000 (15:17 +0200)
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 <john.mcnamara@intel.com>
app/test/autotest.py
app/test/autotest_runner.py

index 5d6adb6fecf61145913b2c0b4aaddb5282dd77d0..b9fd6b6f5b214fc90720465ee61a84e42aaf1f3a 100644 (file)
@@ -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)
index 7d28707f9562c1df93f20d46d9ffbee1d78ba47b..eadfb7f9a9588cdc6654e35f058a32afe1ffec28 100644 (file)
@@ -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