]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit1252f4b33f3d48672fe7565e74a92a819b6f835e
tree822359e259c4a2d526c266aeb4ef4657a44c5e55
parent2eb9d327eed709d4cbbbc65855576119993c4ea4
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