aboutsummaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts')
-rwxr-xr-xtests/scripts/gen-simple4
-rwxr-xr-xtests/scripts/gen-tests29
2 files changed, 32 insertions, 1 deletions
diff --git a/tests/scripts/gen-simple b/tests/scripts/gen-simple
index 418cc02..a942fb3 100755
--- a/tests/scripts/gen-simple
+++ b/tests/scripts/gen-simple
@@ -28,8 +28,10 @@ echo " timeout --foreground 30s \$(QEMU) \
echo "TESTS += $NAME" >> tests.mk
echo ".PHONY: $NAME" >> tests.mk
-echo "$NAME: reports/$NAME/log" >> tests.mk
+echo "reports/$NAME/OK: reports/$NAME/log" >> tests.mk
echo " grep 'BUG' reports/$NAME/log \\" >> tests.mk
echo " && echo 'BUG' > reports/$NAME/log \\" >> tests.mk
echo " || tail -n1 reports/$NAME/log | tr -d '\\\\r' \\" >> tests.mk
echo " > reports/$NAME/OK" >> tests.mk
+
+echo "$NAME: reports/$NAME/OK" >> tests.mk
diff --git a/tests/scripts/gen-tests b/tests/scripts/gen-tests
new file mode 100755
index 0000000..7095e30
--- /dev/null
+++ b/tests/scripts/gen-tests
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+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
+
+ echo "build/$NAME/init: $NAME/init.c \$(COMMON) \$(KMI)" >> tests.mk
+ echo " \$(COMPILE_TEST) $NAME/init.c \$(COMMON) -o build/$NAME/init" >> tests.mk
+
+ echo "build/$NAME/initrd: build/$NAME/init" >> tests.mk
+ echo " echo build/$NAME/init | \$(GEN_INITRD) build/$NAME/initrd" >> tests.mk
+
+ echo "reports/$NAME/log: build/$NAME/initrd" >> tests.mk
+ echo " timeout --foreground 30s \$(QEMU) \
+ build/$NAME/initrd > reports/$NAME/log" >> tests.mk
+
+ echo "reports/$NAME/OK: reports/$NAME/log" >> tests.mk
+ echo " grep 'BUG' reports/$NAME/log \\" >> tests.mk
+ echo " && echo 'BUG' > reports/$NAME/log \\" >> tests.mk
+ echo " || tail -n1 reports/$NAME/log | tr -d '\\\\r' \\" >> tests.mk
+ echo " > reports/$NAME/OK" >> tests.mk
+
+ echo "TESTS += $NAME" >> tests.mk
+ echo ".PHONY: $NAME" >> tests.mk
+ echo "$NAME: reports/$NAME/OK" >> tests.mk
+done