summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 24 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index ae01373..d16e220 100644
--- a/Makefile
+++ b/Makefile
@@ -134,12 +134,25 @@ $(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS)
134check: $(TESTBIN) $(BINARY) 134check: $(TESTBIN) $(BINARY)
135 ./$(TESTBIN) 135 ./$(TESTBIN)
136 136
137# The same unit tests under the sanitizers. Use clang over $(CC) because the
138# two toolchains do not check the same things
139# Override CC_sanitize to use another compiler.
140CC_sanitize?=clang
141CFLAGS_sanitize=$(CFLAGS_test) -fsanitize=address,undefined -fno-omit-frame-pointer
142LDFLAGS_sanitize=$(LDFLAGS) -fsanitize=address,undefined
143
144$(TESTBIN).sanitize: $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS)
145 $(CC_sanitize) -o $@ $(CFLAGS_sanitize) $(TEST_SOURCES) $(TEST_UNITS) $(LDFLAGS_sanitize)
146
147check-sanitize: $(TESTBIN).sanitize
148 ./$(TESTBIN).sanitize
149
137# Black box tests: these drive the real binary over the wire, so they cover 150# Black box tests: these drive the real binary over the wire, so they cover
138# the event loop and the parsers working together, which the unit tests 151# the event loop and the parsers working together, which the unit tests
139# cannot reach. Built with the sanitizers on, so the tracker reports its own 152# cannot reach. Built with the sanitizers on, so the tracker reports its own
140# memory errors and the harness turns those into failures. 153# memory errors and the harness turns those into failures.
141PYTHON?=python3 154PYTHON?=python3
142FEATURES_integration=$(FEATURES) -DWANT_IP_FROM_QUERY_STRING 155FEATURES_integration=$(FEATURES) -DWANT_IP_FROM_QUERY_STRING -DWANT_ACCESSLIST_BLACK -DWANT_KEEPALIVE
143CFLAGS_integration=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=address,undefined -fno-omit-frame-pointer 156CFLAGS_integration=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=address,undefined -fno-omit-frame-pointer
144LDFLAGS_integration=$(LDFLAGS) -fsanitize=address,undefined 157LDFLAGS_integration=$(LDFLAGS) -fsanitize=address,undefined
145 158
@@ -149,10 +162,18 @@ opentracker.integration: $(SOURCES) $(HEADERS)
149check-integration: opentracker.integration 162check-integration: opentracker.integration
150 OPENTRACKER=./opentracker.integration $(PYTHON) -m unittest discover -s tests/integration 163 OPENTRACKER=./opentracker.integration $(PYTHON) -m unittest discover -s tests/integration
151 164
152.PHONY: all check check-integration clean install 165# Everything, cheapest first, so a quick failure comes back quickly.
166check-all:
167 $(MAKE) check
168 $(MAKE) check-sanitize
169 $(MAKE) check-integration
170
171.PHONY: all check check-sanitize check-integration check-all clean install
172
173BINARIES=opentracker opentracker.debug opentracker.integration proxy proxy.debug $(TESTBIN) $(TESTBIN).sanitize
153 174
154clean: 175clean:
155 rm -rf opentracker opentracker.debug opentracker.integration proxy proxy.debug $(TESTBIN) *.o *~ 176 rm -rf $(BINARIES) $(BINARIES:=.dSYM) *.o *~
156 177
157install: 178install:
158 install -m 755 opentracker $(DESTDIR)$(BINDIR) 179 install -m 755 opentracker $(DESTDIR)$(BINDIR)