Messages in this thread | | | From | Daniel Latypov <> | Date | Fri, 8 Apr 2022 16:54:26 -0500 | Subject | Re: [PATCH] kunit: tool: Print a total count of tests. |
| |
On Fri, Apr 8, 2022 at 2:04 PM Daniel Latypov <dlatypov@google.com> wrote: <snip>
> E.g. I get this output > Ran 173 tests: passed: 137, skipped: 36 > > with a new combined patch of > > 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 >
Sent this patch out as a v2, https://lore.kernel.org/linux-kselftest/20220408215105.2332902-1-dlatypov@google.com/
| |