summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-24 01:17:50 +0200
committerDirk Engling <erdgeist@erdgeist.org>2026-10-24 01:17:50 +0200
commitf24ec48b27d4cb8dd0555840206dedbb45f1423c (patch)
tree4cf772a476be6b06f52b80abc05f952a33209711 /Makefile
parentf33203e15a00449152283cab2b878c0886fcede5 (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--Makefile20
1 files changed, 19 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 706b742..8f967f7 100644
--- a/Makefile
+++ b/Makefile
@@ -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.
106TESTBIN=tests/runner
107TEST_SOURCES=tests/runner.c tests/test.c tests/stubs.c tests/t_scan_urlencoded_query.c tests/t_iovec.c tests/t_vector.c
108TEST_UNITS=scan_urlencoded_query.c ot_iovec.c ot_vector.c
109TEST_HEADERS=tests/test.h $(HEADERS)
110CFLAGS_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
115check: $(TESTBIN)
116 ./$(TESTBIN)
117
118.PHONY: all check clean install
119
102clean: 120clean:
103 rm -rf opentracker opentracker.debug *.o *~ 121 rm -rf opentracker opentracker.debug $(TESTBIN) *.o *~
104 122
105install: 123install:
106 install -m 755 opentracker $(DESTDIR)$(BINDIR) 124 install -m 755 opentracker $(DESTDIR)$(BINDIR)