aboutsummaryrefslogtreecommitdiff
path: root/tests/scripts/gen-tests
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-04-22 21:09:09 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-04-22 21:09:09 +0300
commit9d735045e0b73b46443f9dacd1b42f5ac3e734de (patch)
treeaab90f47777ba3f8fb7b7760c4457426d7cf62a2 /tests/scripts/gen-tests
parent96eca4b42f1efc4fbb663dd6994a43fcdf26bf5d (diff)
downloadkmi-9d735045e0b73b46443f9dacd1b42f5ac3e734de.tar.gz
kmi-9d735045e0b73b46443f9dacd1b42f5ac3e734de.zip
simplify generator scripts
Diffstat (limited to 'tests/scripts/gen-tests')
-rwxr-xr-xtests/scripts/gen-tests31
1 files changed, 13 insertions, 18 deletions
diff --git a/tests/scripts/gen-tests b/tests/scripts/gen-tests
index 3be204d..57dba8f 100755
--- a/tests/scripts/gen-tests
+++ b/tests/scripts/gen-tests
@@ -3,27 +3,22 @@
mkdir -p $(for d in "${@}"; do echo $d; done | sed "s|^|build/|")
mkdir -p $(for d in "${@}"; do echo $d; done | sed "s|^|reports/|")
-for NAME in "${@}"; do
- echo "build/$NAME/init.d:" >> tests.mk
- echo "-include build/$NAME/init.d" >> tests.mk
+for NAME in "${@}"; do cat << ENDRULES >> tests.mk
+build/$NAME/init.d:
+-include build/$NAME/init.d
- echo "build/$NAME/init: $NAME/init.c \$(COMMON) \$(KMI)" >> tests.mk
- echo " \$(COMPILE_TEST) $NAME/init.c \$(COMMON) -o build/$NAME/init" >> tests.mk
+build/$NAME/init: $NAME/init.c \$(COMMON) \$(KMI)
+ \$(COMPILE_TEST) $NAME/init.c \$(COMMON) -o build/$NAME/init
- echo "build/$NAME/initrd: build/$NAME/init" >> tests.mk
- echo " echo build/$NAME/init | \$(GEN_INITRD) build/$NAME/initrd" >> tests.mk
+build/$NAME/initrd: build/$NAME/init
+ echo build/$NAME/init | \$(GEN_INITRD) build/$NAME/initrd
- echo "reports/$NAME/log: build/$NAME/initrd" >> tests.mk
- echo " timeout --foreground 30s \$(QEMU) \
- build/$NAME/initrd > reports/$NAME/log" >> tests.mk
+reports/$NAME/log: build/$NAME/initrd
+ timeout --foreground 30s \$(QEMU) build/$NAME/initrd > reports/$NAME/log
- echo "reports/$NAME/OK: reports/$NAME/log" >> tests.mk
- echo " grep 'BUG|ERROR' reports/$NAME/log \\" >> tests.mk
- echo " && echo 'NOTOK' > reports/$NAME/log \\" >> tests.mk
- echo " || tail -n1 reports/$NAME/log | tr -d '\\\\r' \\" >> tests.mk
- echo " > reports/$NAME/OK" >> tests.mk
+TESTS += $NAME
+.PHONY: $NAME
+$NAME: reports/$NAME/log
- echo "TESTS += $NAME" >> tests.mk
- echo ".PHONY: $NAME" >> tests.mk
- echo "$NAME: reports/$NAME/OK" >> tests.mk
+ENDRULES
done