diff mbox series

[v2,03/14] selftests/nolibc: print running log to screen

Message ID 1373113bdaf2d4812c3d712684bd0019f992a032.1689759351.git.falcon@tinylab.org
State New
Headers show
Series selftests/nolibc: add minimal kernel config support - part1 | expand

Commit Message

Zhangjin Wu July 19, 2023, 1:20 p.m. UTC
When poweroff fails, qemu-system will hang there without any output.

It is very hard to debug in such case, let's print the running log to
the screen to allow users to learn what is happening at the first
glance, without editing the Makefile manually every time.

To get a clean output, the 'grep status' command can be used.

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 tools/testing/selftests/nolibc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Willy Tarreau July 22, 2023, 12:29 p.m. UTC | #1
On Wed, Jul 19, 2023 at 09:20:17PM +0800, Zhangjin Wu wrote:
> When poweroff fails, qemu-system will hang there without any output.
> 
> It is very hard to debug in such case, let's print the running log to
> the screen to allow users to learn what is happening at the first
> glance, without editing the Makefile manually every time.
> 
> To get a clean output, the 'grep status' command can be used.

The problem with doing this is that it rolls back to the initial
version that breaks with qemu. When its stdout is sent to a pipe, we've
found that the output got randomly mangled and/or missing contents.
It's only when sent to a file that it's OK. I suspect it has something
to do with non-blocking writes being used to avoid blocking the
emulation but I could be totally wrong. That's the reason why we had
to switch to a file.

And I'd rather avoid starting it in the background as well. Maybe
you'd want to run the qemu command under the "timeout" one ? That
could be better than nothing.

Willy
Zhangjin Wu July 25, 2023, 12:46 p.m. UTC | #2
Hi, Willy

> On Wed, Jul 19, 2023 at 09:20:17PM +0800, Zhangjin Wu wrote:
> > When poweroff fails, qemu-system will hang there without any output.
> > 
> > It is very hard to debug in such case, let's print the running log to
> > the screen to allow users to learn what is happening at the first
> > glance, without editing the Makefile manually every time.
> > 
> > To get a clean output, the 'grep status' command can be used.
> 
> The problem with doing this is that it rolls back to the initial
> version that breaks with qemu. When its stdout is sent to a pipe, we've
> found that the output got randomly mangled and/or missing contents.
> It's only when sent to a file that it's OK. I suspect it has something
> to do with non-blocking writes being used to avoid blocking the
> emulation but I could be totally wrong. That's the reason why we had
> to switch to a file.
>

ok, thanks for sharing the history, it is important.

> And I'd rather avoid starting it in the background as well. Maybe
> you'd want to run the qemu command under the "timeout" one ? That
> could be better than nothing.

Yeah, with the timeout logic, this may be not really required, so, let's
drop this patch and the LOG_OUT from the previous one.

with our timeout logic, we are able to quit qemu and then print the
running log to screen to tell users what happens background, let's
discuss timeout logic in its own patch.

Thanks,
Zhangjin

> 
> Willy
diff mbox series

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 8c531518bb9f..f1c8e4a0f1b2 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -168,7 +168,7 @@  libc-test: nolibc-test.c
 
 # common macros for logging
 RUN_OUT = $(CURDIR)/run.out
-LOG_OUT = > "$(RUN_OUT)"
+LOG_OUT = | tee "$(RUN_OUT)"
 REPORT_RUN_OUT = $(REPORT) "$(RUN_OUT)"
 
 # local libc-test