kunit: tool: fix --raw_output to actually show output
PATCH 1/1 kunit: tool: fix --raw_output to actually show output
Currently --raw_output means nothing gets shown.
Why?
Because raw_output() has a yield and therefore is a generator, which means it only executes when you ask it for a value.
Given no one actually is using it as a generator (checked via the added type annotation), drop the yield so we actually print the output.
Also strip off the trailing \n (and any other whitespace) to avoid
[<601d6d3a>] ? printk+0x0/0x9b
[<601e5058>] ? kernel_init+0x23/0x14b
[<600170d2>] ? new_thread_handler+0x82/0xc0
making the output unreadable.
--- tools/testing/kunit/kunit_parser.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tools/testing/kunit/kunit_parser.py +2 -3
@@ -63,10 +63,9 @@ def isolate_kunit_output(kernel_output): elif started: yield line[prefix_len:] if prefix_len > 0 else line -def raw_output(kernel_output): +def raw_output(kernel_output) -> None: for line in kernel_output: - print(line) - yield line + print(line.rstrip()) DIVIDER = '=' * 60
base-commit: 07e0887302450a62f51dba72df6afb5fabb23d1c
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog
Quoted 12 lines · Daniel Latypov
Currently --raw_output means nothing gets shown.
Why?
Becauseraw_output()has ayieldand therefore is a generator, which means it only executes when you ask it for a value.Given no one actually is using it as a generator (checked via the added type annotation), drop the yield so we actually print the output.
Also strip off the trailing \n (and any other whitespace) to avoid
[<601d6d3a>] ?printk+0x0/0x9b
Quoted 7 lines
[<
601e5058>] ?kernel_init+0x23/0x14b[<
600170d2>] ?new_thread_handler+0x82/0xc0
making the output unreadable.Signed-off-by Daniel Latypov <[email protected]>---
The bug where --raw_output doesn't show anything is already fixed[1], but it does still show the extra newlines.
Maybe it's worth making just the newline fix, and rolling it into the other patch[2] handling newlines?
Cheers,
-- David
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit-fixes&id=3023d8ff3fc60e5d32dc1d05f99ad6ffa12b0033
[2]: https://lore.kernel.org/linux-kselftest/[email protected]/
Quoted 16 lines · David Gow
Quoted 14 lines · Daniel Latypov
Currently --raw_output means nothing gets shown.
Why?
Becauseraw_output()has ayieldand therefore is a generator, which means it only executes when you ask it for a value.Given no one actually is using it as a generator (checked via the added type annotation), drop the yield so we actually print the output.
Also strip off the trailing \n (and any other whitespace) to avoid
[<601d6d3a>] ?printk+0x0/0x9b[<
601e5058>] ?kernel_init+0x23/0x14b
Quoted 8 lines
Quoted 5 lines
[<
600170d2>] ?new_thread_handler+0x82/0xc0
making the output unreadable.Signed-off-by Daniel Latypov <[email protected]>---
The bug where --raw_output doesn't show anything is already fixed[1], but it does still show the extra newlines.
I'm not sure how I missed that, sorry for the noise.
Quoted 3 lines
Maybe it's worth making just the newline fix, and rolling it into the other patch[2] handling newlines?
Sounds good.