kunit: tool: update test counts summary line format
PATCH v2 1/1 kunit: tool: update test counts summary line format
Before:
Quoted 1 line
Testing complete. Passed: 137, Failed: 0, Crashed: 0, Skipped: 36, Errors: 0
After:
Quoted 1 line
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.
---
Changes:
v1: https://lore.kernel.org/linux-kselftest/[email protected]/
Combined with the patch David posted in reply after some bikeshedding
about the format.
Now this patch will print the total # of tests as well.
--- tools/testing/kunit/kunit_parser.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/testing/kunit/kunit_parser.py +5 -5
@@ -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
base-commit: b04d1a8dc7e7ff7ca91a20bef053bcc04265d83a
Signature · 1 line
2.35.1.1178.g4f1659d476-goog
Quoted 18 lines · Daniel Latypov
Before:
Quoted 1 line
Testing complete. Passed: 137, Failed: 0, Crashed: 0, Skipped: 36, Errors: 0
After:
Quoted 1 line
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.
Quoted 3 lines
Signed-off-by Daniel Latypov <[email protected]>Co-developed-by David Gow <[email protected]>Signed-off-by David Gow <[email protected]>