[4/4] selftests/nolibc: fix up test-report for run target

Message ID 48a994c40ac739a0e20ed7a34f290637e417bb0b.1685936428.git.falcon@tinylab.org
State New
Headers
Series selftests/nolibc: fix up and improve test report |

Commit Message

Zhangjin Wu June 5, 2023, 3:58 a.m. UTC
  There is a '\r' at the end of every log line when run nolibc-test on
qemu-system (make run), add support for this case, otherwise, the test
result will like this:

    0 test(s) passed, 0 skipped, 0 failed.

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

Comments

Willy Tarreau June 5, 2023, 4:23 a.m. UTC | #1
On Mon, Jun 05, 2023 at 11:58:56AM +0800, Zhangjin Wu wrote:
> There is a '\r' at the end of every log line when run nolibc-test on
> qemu-system (make run), add support for this case, otherwise, the test
> result will like this:
> 
>     0 test(s) passed, 0 skipped, 0 failed.

Argh, sorry for this one! Note that as a general rule, this should have
been the first patch of the series (fixes first so that they can be
squashed into a pending series or backported when already merged).

I'll remerge it into the series for now.

Thank you!
Willy
  

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 518f85c77fe3..70a27fc41c22 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -128,7 +128,7 @@  libc-test: nolibc-test.c
 	$(QUIET_CC)$(CC) -o $@ $<
 
 test-report:
-	$(Q)[ -f $(CURDIR)/run.out ] && awk '/\[OK\]$$/{p++} /\[FAIL\]$$/{f++} /\[SKIPPED\]$$/{s++} \
+	$(Q)[ -f $(CURDIR)/run.out ] && awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{f++} /\[SKIPPED\][\r]*$$/{s++} \
 	         END{ printf("%d test(s) passed, %d skipped, %d failed.", p, s, f); \
 	         printf(" See all results in %s\n", ARGV[1]); }' \
 		 $(CURDIR)/run.out || :