Skip to content

Commit

Permalink
Reintroduced test-defines into the new test_runner
Browse files Browse the repository at this point in the history
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
  • Loading branch information
geky committed Apr 18, 2022
1 parent 56a9903 commit d683f1c
Show file tree
Hide file tree
Showing 5 changed files with 542 additions and 99 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*.a
*.ci
*.csv
*.t.c
*.a.c

# Testing things
blocks/
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -141,6 +143,7 @@ summary: $(BUILDDIR)lfs.csv

# rules
-include $(DEP)
-include $(TEST_TADEP)
.SUFFIXES:
.SECONDARY:

Expand Down Expand Up @@ -202,3 +205,4 @@ clean:
rm -f $(TEST_TSRC)
rm -f $(TEST_TASRC)
rm -f $(TEST_TAOBJ)
rm -f $(TEST_TADEP)

0 comments on commit d683f1c

Please sign in to comment.