aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mtest.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-11-18 14:02:02 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2020-11-18 22:49:41 +0200
commitf1ce78d77f178deb7a458235132d1fc8c44d0afe (patch)
treea3cbc63e3483df2adf0576b0ca62ef8d2f669319 /mesonbuild/mtest.py
parentc8af3c8d29df9535b76ce62a8aafdbb0bc9cc10f (diff)
downloadmeson-f1ce78d77f178deb7a458235132d1fc8c44d0afe.zip
meson-f1ce78d77f178deb7a458235132d1fc8c44d0afe.tar.gz
meson-f1ce78d77f178deb7a458235132d1fc8c44d0afe.tar.bz2
mtest: cleanup and fix print_stats
Avoid calling self.collected_failures.append twice, and avoid inflated indentation by adding a "plain" decorator to mlog. Fixes: ba71fde18 ("mtest: collect failures regardless of colorized console", 2020-10-12)
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r--mesonbuild/mtest.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 35cb10a..e538992 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -918,20 +918,15 @@ class TestHarness:
dur=result.duration)
if result.res is TestResult.FAIL:
result_str += ' ' + returncode_to_status(result.returncode)
+ if result.res in bad_statuses:
+ self.collected_failures.append(result_str)
if not self.options.quiet or result.res not in ok_statuses:
- if result.res not in ok_statuses:
- self.collected_failures.append(result_str)
- if mlog.colorize_console():
- if result.res in bad_statuses:
- self.collected_failures.append(result_str)
- decorator = mlog.red
- elif result.res is TestResult.SKIP:
- decorator = mlog.yellow
- else:
- sys.exit('Unreachable code was ... well ... reached.')
- print(decorator(result_str).get_text(True))
- else:
- print(result_str)
+ decorator = mlog.plain
+ if result.res in bad_statuses:
+ decorator = mlog.red
+ elif result.res is TestResult.SKIP:
+ decorator = mlog.yellow
+ print(decorator(result_str).get_text(mlog.colorize_console()))
result_str += "\n\n" + result.get_log()
if result.res in bad_statuses:
if self.options.print_errorlogs: