diff options
author | David Phillips <david@yeah.nah.nz> | 2021-02-13 18:21:36 +1300 |
---|---|---|
committer | David Phillips <david@yeah.nah.nz> | 2021-02-13 18:25:28 +1300 |
commit | 4710921284adbf5005421515fbab5dd1aa38e9aa (patch) | |
tree | 18d1850a58c58f0095c8752a76ef8584a2628dbc /Makefile | |
parent | 8ab11293cdd2a47e7950fa9c488cbc504325cad3 (diff) | |
download | altimeter-4710921284adbf5005421515fbab5dd1aa38e9aa.tar.xz |
Add test runner
This patch adds a "magic" test runner which discovers all test cases in the
executable into which it is linked. This is achieved through the use of a
special macro used to declare tests, so that they are added onto a linker-
generated list. The linker list logic is largely taken from U-Boot source code,
with minor some tweaks made.
This linker-generated list is then used at runtime in order to pick out every
test case which can be run, resulting in a cross-file "suite" of unity unit
tests, rather than separate test executables per module. A sample test module,
test_test.c is provided to illustrate the test runner's ability to correctly
discover tests across multiple translation units.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -51,9 +51,11 @@ clean: test: \ $(UNITY_O) \ + build/native/test_runner.o \ build/native/test_util.o \ + build/native/test_test.o \ build/native/util.o - $(CC) $(LDFLAGS) -o $@ $^ + $(CC) $(LDFLAGS) -Wl,-T,linker_list.lds -o $@ $^ ./$@ # ELF for real hardware. No mock/sim hardware included (except barometer, |