From d127146846f4d6561e15000d1469b715dafdb627 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 2 Nov 2024 15:28:23 +0200 Subject: initial exec support --- tests/scripts/gen-simple | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'tests/scripts/gen-simple') diff --git a/tests/scripts/gen-simple b/tests/scripts/gen-simple index a942fb3..fe2d7a4 100755 --- a/tests/scripts/gen-simple +++ b/tests/scripts/gen-simple @@ -10,6 +10,8 @@ while getopts "n:p:" opt; do esac done +mkdir -p "build/$NAME" + if [ -z "$NAME" ]; then echo "No name given for tests" >&2; exit 2; fi @@ -18,13 +20,28 @@ if [ -z "$PROGS" ]; then echo "No programs to add to initrd" >&2; exit 3; fi -echo "build/$NAME/initrd: build/$NAME/init \$(COMMON) \$(KMI)" >> tests.mk -echo " echo build/$NAME/init | \$(GEN_INITRD) build/$NAME/initrd" >> tests.mk +for p in $PROGS +do + dep="build/${NAME}/${p}.d" + + echo "${NAME}_PROGS += build/${NAME}/${p}" >> tests.mk + echo "${dep}:" >> tests.mk + echo "-include ${dep}" >> tests.mk + echo "build/${NAME}/${p}: $NAME/$p.c \$(COMMON)" >> tests.mk + echo " \$(COMPILE_TEST) $NAME/${p}.c \$(COMMON) \\" >> tests.mk + echo " -o build/${NAME}/${p}" >> tests.mk +done + +echo "build/$NAME/initrd: \$(${NAME}_PROGS) \$(COMMON) \$(KMI)" >> tests.mk +echo " for p in \$(${NAME}_PROGS); do \\" >> tests.mk +echo " echo \$\$p; \\" >> tests.mk +echo " done | \$(GEN_INITRD) build/$NAME/initrd" >> tests.mk + echo "reports/$NAME/log: build/$NAME/initrd" >> tests.mk echo " mkdir -p reports/$NAME" >> tests.mk echo " rm -f reports/$NAME/*" >> tests.mk -echo " timeout --foreground 30s \$(QEMU) \ - build/$NAME/initrd > reports/$NAME/log" >> tests.mk +echo " timeout --foreground 30s \$(QEMU) \\" >> tests.mk +echo " build/$NAME/initrd > reports/$NAME/log" >> tests.mk echo "TESTS += $NAME" >> tests.mk echo ".PHONY: $NAME" >> tests.mk -- cgit v1.3