diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-24 01:17:50 +0200 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-24 01:17:50 +0200 |
| commit | f24ec48b27d4cb8dd0555840206dedbb45f1423c (patch) | |
| tree | 4cf772a476be6b06f52b80abc05f952a33209711 /Makefile | |
| parent | f33203e15a00449152283cab2b878c0886fcede5 (diff) | |
Add a unit test harness and a first set of tests
make check builds tests/runner from the modules that link without the
io subsystem and runs it.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 20 |
1 files changed, 19 insertions, 1 deletions
| @@ -99,8 +99,26 @@ proxy.debug: $(OBJECTS_proxy_debug) $(HEADERS) | |||
| 99 | .c.o : $(HEADERS) | 99 | .c.o : $(HEADERS) |
| 100 | $(CC) -c -o $@ $(CFLAGS_production) $< | 100 | $(CC) -c -o $@ $(CFLAGS_production) $< |
| 101 | 101 | ||
| 102 | # Unit tests. The modules under test are compiled straight into the test | ||
| 103 | # binary, so a test may reach a static function by including the source if it | ||
| 104 | # has to. tests/stubs.c supplies the few symbols those modules reference but | ||
| 105 | # the tests never reach. | ||
| 106 | TESTBIN=tests/runner | ||
| 107 | TEST_SOURCES=tests/runner.c tests/test.c tests/stubs.c tests/t_scan_urlencoded_query.c tests/t_iovec.c tests/t_vector.c | ||
| 108 | TEST_UNITS=scan_urlencoded_query.c ot_iovec.c ot_vector.c | ||
| 109 | TEST_HEADERS=tests/test.h $(HEADERS) | ||
| 110 | CFLAGS_test = $(CFLAGS) -I. -g -O1 $(FEATURES) | ||
| 111 | |||
| 112 | $(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) | ||
| 113 | $(CC) -o $@ $(CFLAGS_test) $(TEST_SOURCES) $(TEST_UNITS) | ||
| 114 | |||
| 115 | check: $(TESTBIN) | ||
| 116 | ./$(TESTBIN) | ||
| 117 | |||
| 118 | .PHONY: all check clean install | ||
| 119 | |||
| 102 | clean: | 120 | clean: |
| 103 | rm -rf opentracker opentracker.debug *.o *~ | 121 | rm -rf opentracker opentracker.debug $(TESTBIN) *.o *~ |
| 104 | 122 | ||
| 105 | install: | 123 | install: |
| 106 | install -m 755 opentracker $(DESTDIR)$(BINDIR) | 124 | install -m 755 opentracker $(DESTDIR)$(BINDIR) |
