]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
kunit:tool: Don't write to stdout when it should be disabled
authorDavid Gow <david@davidgow.net>
Sat, 6 Jun 2026 02:03:15 +0000 (10:03 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 8 Jun 2026 02:10:30 +0000 (20:10 -0600)
commit29afed142d64e181749214072315c976f8510bd7
treefcbe482e51ad64fbe21e379280bf2674cecad2e9
parente9e05c72752f9d7044b3c98b863cd04ca828e258
kunit:tool: Don't write to stdout when it should be disabled

The kunit_parser module accepts a 'printer' object which is used as a
destination for all output. This is typically set to stdout, so that the
parsed results are visible, but can be set to a special 'null_printer' to
implement options where not all results are always printed.

However, there are a few places where use of stdout is hardcoded, notably
in handling crashed tests and in outputting the colour escape sequences.

Properly use the specified printer for all output. This is okay for the
colour handling (as this is already gated behind isatty() anyway), and also
for the crash handling, as cases where printer != stdout are separately
printed afterwards.

Link: https://lore.kernel.org/r/20260606020317.264178-1-david@davidgow.net
Fixes: 062a9dd9bad7 ("kunit: tool: Only print the summary")
Signed-off-by: David Gow <david@davidgow.net>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/kunit/kunit_parser.py