diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-26 18:34:24 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-26 18:34:24 +0300 |
| commit | eff7f52c368df5dc662d54956de5aa3b2b9ee936 (patch) | |
| tree | f3ba4e898e3aea5377e0227442044c9bf296d45f | |
| parent | a9d61501eb0200576bb08ba4b287f66177253ad9 (diff) | |
| download | kmi-eff7f52c368df5dc662d54956de5aa3b2b9ee936.tar.gz kmi-eff7f52c368df5dc662d54956de5aa3b2b9ee936.zip | |
simplify tests
| -rw-r--r-- | tests/fork/check.mk | 4 | ||||
| -rw-r--r-- | tests/hello-world/check.mk | 5 | ||||
| -rw-r--r-- | tests/ipc-notify/check.mk | 4 | ||||
| -rw-r--r-- | tests/ipc-req/check.mk | 4 | ||||
| -rw-r--r-- | tests/malloc/check.mk | 4 | ||||
| -rw-r--r-- | tests/noop/check.mk | 3 | ||||
| -rwxr-xr-x | tests/scripts/gen-prog | 4 | ||||
| -rwxr-xr-x | tests/scripts/gen-simple | 10 | ||||
| -rw-r--r-- | tests/scripts/makefile | 5 |
9 files changed, 11 insertions, 32 deletions
diff --git a/tests/fork/check.mk b/tests/fork/check.mk deleted file mode 100644 index 272c5ab..0000000 --- a/tests/fork/check.mk +++ /dev/null @@ -1,4 +0,0 @@ -fork: do-fork - @grep 'BUG' reports/fork/log \ - && echo 'BUG' > reports/fork/OK \ - || tail -n1 reports/fork/log | tr -d '\r' > reports/fork/OK diff --git a/tests/hello-world/check.mk b/tests/hello-world/check.mk deleted file mode 100644 index 7fbabc9..0000000 --- a/tests/hello-world/check.mk +++ /dev/null @@ -1,5 +0,0 @@ -REPORT := reports/hello-world -hello-world: do-hello-world - @grep 'Hello, world!' $(REPORT)/log > /dev/null \ - && echo "OK" > $(REPORT)/OK \ - || echo "ERR" > $(REPORT)/ERR diff --git a/tests/ipc-notify/check.mk b/tests/ipc-notify/check.mk deleted file mode 100644 index 54da852..0000000 --- a/tests/ipc-notify/check.mk +++ /dev/null @@ -1,4 +0,0 @@ -ipc-notify: do-ipc-notify - @grep 'BUG' reports/ipc-notify/log \ - && echo 'BUG' > reports/ipc-notify/OK \ - || tail -n1 reports/ipc-notify/log | tr -d '\r' > reports/ipc-notify/OK diff --git a/tests/ipc-req/check.mk b/tests/ipc-req/check.mk deleted file mode 100644 index db9f580..0000000 --- a/tests/ipc-req/check.mk +++ /dev/null @@ -1,4 +0,0 @@ -ipc-req: do-ipc-req - @grep 'BUG' reports/ipc-req/log \ - && echo 'BUG' > reports/ipc-req/OK \ - || tail -n1 reports/ipc-req/log | tr -d '\r' > reports/ipc-req/OK diff --git a/tests/malloc/check.mk b/tests/malloc/check.mk deleted file mode 100644 index 3a178cb..0000000 --- a/tests/malloc/check.mk +++ /dev/null @@ -1,4 +0,0 @@ -malloc: do-malloc - @grep 'BUG' reports/malloc/log \ - && echo 'BUG' > reports/malloc/OK \ - || tail -n1 reports/malloc/log | tr -d '\r' > reports/malloc/OK diff --git a/tests/noop/check.mk b/tests/noop/check.mk deleted file mode 100644 index f4741cb..0000000 --- a/tests/noop/check.mk +++ /dev/null @@ -1,3 +0,0 @@ -noop: do-noop - @# remove carriage returns before writing status - @tail -n1 reports/noop/log | tr -d '\r' > reports/noop/OK diff --git a/tests/scripts/gen-prog b/tests/scripts/gen-prog index e56ecc3..6e99f37 100755 --- a/tests/scripts/gen-prog +++ b/tests/scripts/gen-prog @@ -23,12 +23,10 @@ do echo "${NAME}_OBJS += ${obj}" >> tests.mk echo "${dep}:" >> tests.mk echo "-include ${dep}" >> tests.mk - echo "${obj}: $NAME/${s}" >> tests.mk + echo "${obj}: $NAME/${s} \$(COMMON)" >> tests.mk echo " \$(COMPILE_TEST) -c $NAME/${s} -o ${obj}" >> tests.mk done echo "build/${NAME}/$PROG: \$(${NAME}_OBJS) \$(COMMON)" >> tests.mk echo " \$(COMPILE_TEST) \$(${NAME}_OBJS) \$(COMMON) \ -o build/${NAME}/$PROG" >> tests.mk - -echo "include ${NAME}/check.mk" >> tests.mk diff --git a/tests/scripts/gen-simple b/tests/scripts/gen-simple index ddec9a4..418cc02 100755 --- a/tests/scripts/gen-simple +++ b/tests/scripts/gen-simple @@ -26,6 +26,10 @@ echo " rm -f reports/$NAME/*" >> tests.mk echo " timeout --foreground 30s \$(QEMU) \ build/$NAME/initrd > reports/$NAME/log" >> tests.mk -echo "TESTS += $NAME" >> tests.mk -echo ".PHONY: do-$NAME" >> tests.mk -echo "do-$NAME: reports/$NAME/log" >> tests.mk +echo "TESTS += $NAME" >> tests.mk +echo ".PHONY: $NAME" >> tests.mk +echo "$NAME: 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 diff --git a/tests/scripts/makefile b/tests/scripts/makefile index 530e0bb..7b861e2 100644 --- a/tests/scripts/makefile +++ b/tests/scripts/makefile @@ -12,7 +12,8 @@ COMPILER != [ "$(LLVM)" != "0" ] \ OBFLAGS := -ffreestanding -nostdlib -std=c17 -g INCLUDEFLAGS := -I ../include -I. WARNFLAGS := -Wall -Wextra -COMPILE_TEST := $(COMPILER) $(WARNFLAGS) $(INCLUDEFLAGS) $(OBFLAGS) +DEPFLAGS = -MT $@ -MMD -MP -MF $@.d +COMPILE_TEST = $(COMPILER) $(WARNFLAGS) $(INCLUDEFLAGS) $(DEPFLAGS) $(OBFLAGS) GEN_INITRD := cpio -H newc -o > QEMU := qemu-system-$(ARCH) -machine virt -kernel ../kmi.bin \ @@ -26,7 +27,7 @@ QEMU := qemu-system-$(ARCH) -machine virt -kernel ../kmi.bin \ KMI := ../kmi.bin COMMON := build/printf.o -build/printf.o: common/printf.c +build/printf.o: common/printf.c $(KMI) $(COMPILE_TEST) -c common/printf.c -o build/printf.o include tests.mk |
