aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Latypov <dlatypov@google.com>2022-04-08 14:51:05 -0700
committerShuah Khan <skhan@linuxfoundation.org>2022-05-12 11:15:26 -0600
commitc249764320cba8ab42821b0c7dad75f117c853e4 (patch)
tree7fb82b7e67eddfe19fbe983c901f0732320c72c8
parentkunit: bail out of test filtering logic quicker if OOM (diff)
downloadlinux-dev-c249764320cba8ab42821b0c7dad75f117c853e4.tar.xz
linux-dev-c249764320cba8ab42821b0c7dad75f117c853e4.zip
kunit: tool: update test counts summary line format
Before: > Testing complete. Passed: 137, Failed: 0, Crashed: 0, Skipped: 36, Errors: 0 After: > Testing complete. Ran 173 tests: passed: 137, skipped: 36 Even with our current set of statuses, the output is a bit verbose. It could get worse in the future if we add more (e.g. timeout, kasan). Let's only print the relevant ones. I had previously been sympathetic to the argument that always printing out all the statuses would make it easier to parse results. But now we have commit acd8e8407b8f ("kunit: Print test statistics on failure"), there are test counts printed out in the raw output. We don't currently print out an overall total across all suites, but it would be easy to add, if we see a need for that. Signed-off-by: Daniel Latypov <dlatypov@google.com> Co-developed-by: David Gow <davidgow@google.com> Signed-off-by: David Gow <davidgow@google.com> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-rw-r--r--tools/testing/kunit/kunit_parser.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kunit_parser.py
index 807ed2bd6832..de1c0b7e14ed 100644
--- a/tools/testing/kunit/kunit_parser.py
+++ b/tools/testing/kunit/kunit_parser.py
@@ -94,11 +94,11 @@ class TestCounts:
def __str__(self) -> str:
"""Returns the string representation of a TestCounts object.
"""
- return ('Passed: ' + str(self.passed) +
- ', Failed: ' + str(self.failed) +
- ', Crashed: ' + str(self.crashed) +
- ', Skipped: ' + str(self.skipped) +
- ', Errors: ' + str(self.errors))
+ statuses = [('passed', self.passed), ('failed', self.failed),
+ ('crashed', self.crashed), ('skipped', self.skipped),
+ ('errors', self.errors)]
+ return f'Ran {self.total()} tests: ' + \
+ ', '.join(f'{s}: {n}' for s, n in statuses if n > 0)
def total(self) -> int:
"""Returns the total number of test cases within a test