kunit: tool: refactoring printing logic into kunit_printer.py
authorDaniel Latypov <dlatypov@google.com>
Mon, 16 May 2022 19:47:30 +0000 (12:47 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 7 Jul 2022 23:46:25 +0000 (17:46 -0600)
commite756dbebd95d7ea7ae2a2343e8924eee10ec6253
tree822359e259c4a2d526c266aeb4ef4657a44c5e55
parent8a04930f2bb0047de4ae18af12e5731084bd555c
kunit: tool: refactoring printing logic into kunit_printer.py

Context:
* kunit_kernel.py is importing kunit_parser.py just to use the
  print_with_timestamp() function
* the parser is directly printing to stdout, which will become an issue
  if we ever try to run multiple kernels in parallel

This patch introduces a kunit_printer.py file and migrates callers of
kunit_parser.print_with_timestamp() to call
kunit_printer.stdout.print_with_timestamp() instead.

Future changes:
If we want to support showing results for parallel runs, we could then
create new Printer's that don't directly write to stdout and refactor
the code to pass around these Printer objects.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit.py
tools/testing/kunit/kunit_kernel.py
tools/testing/kunit/kunit_parser.py
tools/testing/kunit/kunit_printer.py [new file with mode: 0644]
tools/testing/kunit/kunit_tool_test.py