Reintroduced test-defines into the new test_runner

This moves defines entirely into the runtime of the test_runner,
simplifying thing and reducing the amount of generated code that needs
to be build, at the cost of limiting test-defines to uintmax_t types.

This is implemented using a set of index-based scopes (created by
test.py) that allow different layers to override defines from other
layers, accessible through the global `test_define` function.

layers:
1. command-line overrides
2. per-case defines
3. per-geometry defines
This commit is contained in:
Christopher Haster
2022-04-17 21:41:38 -05:00
parent 56a990336b
commit d683f1c76c
5 changed files with 542 additions and 99 deletions
+7 -3
View File
@@ -33,11 +33,13 @@ ASM := $(SRC:%.c=$(BUILDDIR)%.s)
CGI := $(SRC:%.c=$(BUILDDIR)%.ci)
TESTS ?= $(wildcard tests_/*.toml)
TEST_TSRC := $(TESTS:%.toml=$(BUILDDIR)%.t.c) \
$(SRC:%.c=$(BUILDDIR)%.t.c) \
$(BUILDDIR)runners/test_runner.t.c
TEST_SRC ?= $(SRC) \
$(filter-out $(wildcard bd/*.*.c),$(wildcard bd/*.c)) \
runners/test_runner.c
TEST_TSRC := $(TESTS:%.toml=$(BUILDDIR)%.t.c) $(TEST_SRC:%.c=$(BUILDDIR)%.t.c)
TEST_TASRC := $(TEST_TSRC:%.t.c=%.t.a.c)
TEST_TAOBJ := $(TEST_TASRC:%.t.a.c=%.t.a.o)
TEST_TADEP := $(TEST_TASRC:%.t.a.c=%.t.a.d)
ifdef DEBUG
override CFLAGS += -O0
@@ -141,6 +143,7 @@ summary: $(BUILDDIR)lfs.csv
# rules
-include $(DEP)
-include $(TEST_TADEP)
.SUFFIXES:
.SECONDARY:
@@ -202,3 +205,4 @@ clean:
rm -f $(TEST_TSRC)
rm -f $(TEST_TASRC)
rm -f $(TEST_TAOBJ)
rm -f $(TEST_TADEP)