diff mbox series

[v1,21/22] selftests/nolibc: allow run tests on all targets

Message ID 49a3c3f75e2f433f42112a246b20488bf7c9e7f4.1687706332.git.falcon@tinylab.org (mailing list archive)
State New
Headers show
Series selftests/nolibc: add minimal kernel config support | expand

Commit Message

Zhangjin Wu June 25, 2023, 4:43 p.m. UTC
This lists all of the supported architectures and allow testing for all
of them.

These targets are supported:

- run-user-all: testing run-user for all architectures
- run-all / run-default-all: testing run-default for all architectures
- run-tiny-all: testing run-tiny for all architectures

Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
---
 tools/testing/selftests/nolibc/Makefile | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index 3e7e51bd7082..470923dc10e1 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -164,6 +164,18 @@  ifeq (run-default, $(MAKECMDGOALS))
 AUTOCONFIG ?= defconfig
 endif
 
+# allow run tests on all architectures: run-user-all, run-all (=run-default-all), run-tiny-all
+ARCHS   ?= $(shell sed -ne 's/^DEFCONFIG_\([^ ]*\) .*/\1/p' $(CURDIR)/Makefile)
+GOALS   ?= run-user run-tiny run-default
+RUN_ALL ?= _t=$@; t=$${_t%-all}; [ "$$t" = "run" ] && t=run-default; \
+	   if echo $(GOALS) | grep -wq "$$t"; then \
+		for a in $(ARCHS); do echo "Testing $$t for $${a}:"; make $$t ARCH=$$a; cp $(CURDIR)/run.out $(CURDIR)/run-$$a.out; done; \
+		echo "\n\nTesting summary of $$t:\n"; \
+		for a in $(ARCHS); do echo $${a}:; echo; $(REPORT) $(CURDIR)/run-$$a.out; echo; done; \
+	   else \
+		echo "Ignoring unknown target: $$t, available targets: $(GOALS)"; \
+	   fi
+
 # allow switch nolibc headers include method: 1 for sysroot, 0 for nolibc.h
 SYSROOT ?= 1
 
@@ -255,6 +267,10 @@  rerun:
 	$(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) $(LOG_OUTPUT)
 	$(Q)$(REPORT) $(CURDIR)/run.out
 
+# test for all architectures
+%-all:
+	$(Q)$(RUN_ALL)
+
 clean:
 	$(call QUIET_CLEAN, sysroot)
 	$(Q)rm -rf sysroot