All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kunit: tool: fix --raw_output to actually show output
@ 2020-10-30  6:16 Daniel Latypov
  2020-10-30  7:22 ` David Gow
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Latypov @ 2020-10-30  6:16 UTC (permalink / raw)
  To: brendanhiggins
  Cc: davidgow, linux-kernel, linux-kselftest, skhan, Daniel Latypov

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.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
---
 tools/testing/kunit/kunit_parser.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kunit_parser.py
index 8019e3dd4c32..c44bb7c27ce6 100644
--- a/tools/testing/kunit/kunit_parser.py
+++ b/tools/testing/kunit/kunit_parser.py
@@ -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
-- 
2.29.1.341.ge80a0c044ae-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kunit: tool: fix --raw_output to actually show output
  2020-10-30  6:16 [PATCH] kunit: tool: fix --raw_output to actually show output Daniel Latypov
@ 2020-10-30  7:22 ` David Gow
  2020-10-30 18:12   ` Daniel Latypov
  0 siblings, 1 reply; 3+ messages in thread
From: David Gow @ 2020-10-30  7:22 UTC (permalink / raw)
  To: Daniel Latypov
  Cc: Brendan Higgins, Linux Kernel Mailing List,
	open list:KERNEL SELFTEST FRAMEWORK, Shuah Khan

On Fri, Oct 30, 2020 at 2:17 PM Daniel Latypov <dlatypov@google.com> wrote:
>
> 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.
>
> Signed-off-by: Daniel Latypov <dlatypov@google.com>
> ---

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/20201020233219.4146059-1-dlatypov@google.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kunit: tool: fix --raw_output to actually show output
  2020-10-30  7:22 ` David Gow
@ 2020-10-30 18:12   ` Daniel Latypov
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Latypov @ 2020-10-30 18:12 UTC (permalink / raw)
  To: David Gow
  Cc: Brendan Higgins, Linux Kernel Mailing List,
	open list:KERNEL SELFTEST FRAMEWORK, Shuah Khan

On Fri, Oct 30, 2020 at 12:23 AM David Gow <davidgow@google.com> wrote:
>
> On Fri, Oct 30, 2020 at 2:17 PM Daniel Latypov <dlatypov@google.com> wrote:
> >
> > 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.
> >
> > Signed-off-by: Daniel Latypov <dlatypov@google.com>
> > ---
>
> 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.

>
> Maybe it's worth making just the newline fix, and rolling it into the
> other patch[2] handling newlines?

Sounds good.

>
> 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/20201020233219.4146059-1-dlatypov@google.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-30 18:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30  6:16 [PATCH] kunit: tool: fix --raw_output to actually show output Daniel Latypov
2020-10-30  7:22 ` David Gow
2020-10-30 18:12   ` Daniel Latypov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.