From 1a0d61b33c2365cf413bf584289058d0d9097377 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 17 Jul 2024 22:02:47 +0300 Subject: make tests a bit more sensible + At least by my standards. Some amount of scripting going on, but should still be fine. Effectively, source.mk contains information to build the test, check.mk checks the generated log from running the test. As a results, check.mk should output OK into reports/$TEST/OK if everything went well, and anything else otherwise. The user can then look at reports/$TEST/log to see what went wrong. I expect to add some more features, such as starting QEMU with gdb and running a single test a bit easier than right now (same limitation as in the top level makefile, i.e. you have to specify make -f scripts/makefile $TEST from within `tests` and you must have ran `make check` at that point so that `tests.mk` is fully generated. Not huge issues, but slightly annoying, somewhat unsure how to work around them properly but we'll see. --- tests/noop/check.mk | 3 +++ tests/noop/source.mk | 10 ++-------- 2 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 tests/noop/check.mk (limited to 'tests/noop') diff --git a/tests/noop/check.mk b/tests/noop/check.mk new file mode 100644 index 0000000..f4741cb --- /dev/null +++ b/tests/noop/check.mk @@ -0,0 +1,3 @@ +noop: do-noop + @# remove carriage returns before writing status + @tail -n1 reports/noop/log | tr -d '\r' > reports/noop/OK diff --git a/tests/noop/source.mk b/tests/noop/source.mk index 3745e37..cbb87b7 100644 --- a/tests/noop/source.mk +++ b/tests/noop/source.mk @@ -1,8 +1,2 @@ -TESTS := $(TESTS) noop - -.PHONY: noop -noop: noop/init.c $(COMMON) - mkdir -p build/noop - $(COMPILE) noop/init.c build/printf.o -o build/noop/init - echo build/noop/init | $(GEN_INITRD) build/noop/initrd - $(QEMU) build/noop/initrd | grep 'OK' +DO != ./scripts/gen-prog -n noop -p init init.c +DO != ./scripts/gen-simple -n noop -p init -- cgit v1.3