From 9d735045e0b73b46443f9dacd1b42f5ac3e734de Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 22 Apr 2025 21:09:09 +0300 Subject: simplify generator scripts --- tests/scripts/gen-tests | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'tests/scripts/gen-tests') 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 -- cgit v1.3