aboutsummaryrefslogtreecommitdiff
path: root/tests/scripts/gen-simple
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-11-02 15:28:23 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2024-11-02 15:28:23 +0200
commitd127146846f4d6561e15000d1469b715dafdb627 (patch)
tree2ee7d7512023df0dc25f0bd51da1c378ebb1a400 /tests/scripts/gen-simple
parent4ce6aa975be40286465cd9ac6a669ff5a95fe5a1 (diff)
downloadkmi-d127146846f4d6561e15000d1469b715dafdb627.tar.gz
kmi-d127146846f4d6561e15000d1469b715dafdb627.zip
initial exec support
Diffstat (limited to 'tests/scripts/gen-simple')
-rwxr-xr-xtests/scripts/gen-simple25
1 files changed, 21 insertions, 4 deletions
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