summaryrefslogtreecommitdiff
path: root/mesonbuild/mtest.py
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-01-02 11:41:36 +0100
committerEli Schwartz <eschwartz93@gmail.com>2025-02-27 15:25:57 -0500
commit23a9a25779db59b213a3dd546fb77625ede95841 (patch)
tree556044933b9e8be1538c85695c1cffef79d8a256 /mesonbuild/mtest.py
parentd3c863997513be81c0c52ef209a57360b771d9e1 (diff)
downloadmeson-23a9a25779db59b213a3dd546fb77625ede95841.tar.gz
mtest: filter summary lines without any results
After a test run finishes we print a summary that sums up test counts by type, e.g. failed or skipped tests. In many cases though it is expected that most of the counts will be zero, and thus the summary is needlessly cluttered with irrelevant lines. This list of mostly-irrelevant results will grow in a subsequent commit where we introduce "Ignored" test results. Prepare for this by filtering results. Instead of unconditionally printing every result, we will now only print those results where we have at least one counted test. The exception is "Ok:" and "Fail:", which will always be printed. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Patrick Steinhardt <ps@pks.im>
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r--mesonbuild/mtest.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 58cfef30e..cd5c5f100 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -23,7 +23,6 @@ import signal
import subprocess
import shlex
import sys
-import textwrap
import time
import typing as T
import unicodedata
@@ -1832,15 +1831,21 @@ class TestHarness:
return prefix + left + middle + right
def summary(self) -> str:
- return textwrap.dedent('''
- Ok: {:<4}
- Expected Fail: {:<4}
- Fail: {:<4}
- Unexpected Pass: {:<4}
- Skipped: {:<4}
- Timeout: {:<4}
- ''').format(self.success_count, self.expectedfail_count, self.fail_count,
- self.unexpectedpass_count, self.skip_count, self.timeout_count)
+ results = {
+ 'Ok: ': self.success_count,
+ 'Expected Fail: ': self.expectedfail_count,
+ 'Fail: ': self.fail_count,
+ 'Unexpected Pass: ': self.unexpectedpass_count,
+ 'Skipped: ': self.skip_count,
+ 'Timeout: ': self.timeout_count,
+ }
+
+ summary = []
+ for result, count in results.items():
+ if count > 0 or result.startswith('Ok:') or result.startswith('Fail:'):
+ summary.append(result + '{:<4}'.format(count))
+
+ return '\n{}\n'.format('\n'.join(summary))
def total_failure_count(self) -> int:
return self.fail_count + self.unexpectedpass_count + self.timeout_count