@@ -98,6 +98,14 @@ CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \
$(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR)
LDFLAGS := -s
+# allow silence the running test log
+QUIET_RUN ?= 0
+ifeq ($(QUIET_RUN),0)
+LOG_OUTPUT = | tee "$(CURDIR)/run.out"
+else
+LOG_OUTPUT = > "$(CURDIR)/run.out"
+endif
+
REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{f++;print} /\[SKIPPED\][\r]*$$/{s++} \
END{ printf("%d test(s) passed, %d skipped, %d failed.\n", p, s, f); \
printf("See all results in %s\n", ARGV[1]); }'
@@ -157,7 +165,7 @@ libc-test: nolibc-test.c
# qemu user-land test
run-user: nolibc-test
- $(Q)qemu-$(QEMU_ARCH) ./nolibc-test > "$(CURDIR)/run.out" || :
+ $(Q)qemu-$(QEMU_ARCH) ./nolibc-test $(LOG_OUTPUT) || :
$(Q)$(REPORT) $(CURDIR)/run.out
initramfs: nolibc-test
@@ -173,12 +181,12 @@ kernel: initramfs
# run the tests after building the kernel
run: kernel
- $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out"
+ $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) $(LOG_OUTPUT)
$(Q)$(REPORT) $(CURDIR)/run.out
# re-run the tests from an existing kernel
rerun:
- $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out"
+ $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) $(LOG_OUTPUT)
$(Q)$(REPORT) $(CURDIR)/run.out
clean:
printing the running log to the screen helps users to learn what happens, especially to find potential issues immediately. If want to silence a lot, simply pass a QUIET_RUN=1 is enough. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> --- tools/testing/selftests/nolibc/Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)