diff mbox series

[v1,20/22] selftests/nolibc: add run-tiny and run-default

Message ID c1142457987895ebc2e3f378c7b30494f45ca48e.1687706332.git.falcon@tinylab.org
State New
Headers show
Series selftests/nolibc: add minimal kernel config support | expand

Commit Message

Zhangjin Wu June 25, 2023, 4:41 p.m. UTC
These two targets allow to do config and run together.

- run-tiny: do tinyconfig, extconfig and then run.
- run-default: do defconfig, extconfig and then run.

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

Patch

diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
index a847a2264fed..3e7e51bd7082 100644
--- a/tools/testing/selftests/nolibc/Makefile
+++ b/tools/testing/selftests/nolibc/Makefile
@@ -156,6 +156,14 @@  REPORT  ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{f++;print} /\[SKIPPED\][\
 		END{ printf("%d test(s) passed, %d skipped, %d failed.\n", p, s, f); \
 		printf("See all results in %s\n", ARGV[1]); }'
 
+# allow run with a config target together: run-tiny = tinyconfig + run; run-default = defconfig + run
+ifeq (run-tiny, $(MAKECMDGOALS))
+AUTOCONFIG ?= tinyconfig
+endif
+ifeq (run-default, $(MAKECMDGOALS))
+AUTOCONFIG ?= defconfig
+endif
+
 # allow switch nolibc headers include method: 1 for sysroot, 0 for nolibc.h
 SYSROOT ?= 1
 
@@ -228,7 +236,7 @@  tinyconfig:
 menuconfig:
 	$(Q)$(MAKE) -C $(srctree) ARCH=$(KARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) menuconfig
 
-extconfig:
+extconfig: $(AUTOCONFIG)
 	$(Q)$(srctree)/scripts/config --file $(srctree)/.config $(EXTCONFIG)
 	$(Q)$(MAKE) -C $(srctree) ARCH=$(KARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG=$(srctree)/.config allnoconfig
 
@@ -240,6 +248,8 @@  run: kernel
 	$(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) $(LOG_OUTPUT)
 	$(Q)$(REPORT) $(CURDIR)/run.out
 
+run-tiny run-default: run
+
 # 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) $(LOG_OUTPUT)