From d830945224cf6d109189da03e924d2dffc6214cd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 21 Feb 2019 16:58:19 +0100 Subject: mtest: do not use return code to look for failed tests --print-errorlogs is using the test's return code to look for failed tests, instead of just looking at the TestResult. Simplify the code and make it work for TAP too. --- mesonbuild/mtest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 74ddd656a..57b4a1211 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -496,9 +496,10 @@ class TestHarness: (num, name, padding1, result.res.value, padding2, result.duration, status) ok_statuses = (TestResult.OK, TestResult.EXPECTEDFAIL) + bad_statuses = (TestResult.FAIL, TestResult.TIMEOUT, TestResult.UNEXPECTEDPASS) if not self.options.quiet or result.res not in ok_statuses: if result.res not in ok_statuses and mlog.colorize_console: - if result.res in (TestResult.FAIL, TestResult.TIMEOUT, TestResult.UNEXPECTEDPASS): + if result.res in bad_statuses: decorator = mlog.red elif result.res is TestResult.SKIP: decorator = mlog.yellow @@ -508,8 +509,7 @@ class TestHarness: else: print(result_str) result_str += "\n\n" + result.get_log() - if (result.returncode != GNU_SKIP_RETURNCODE) \ - and (result.returncode != 0) != result.should_fail: + if result.res in bad_statuses: if self.options.print_errorlogs: self.collected_logs.append(result_str) if self.logfile: -- cgit v1.2.3