diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 27 |
1 files changed, 24 insertions, 3 deletions
| @@ -134,12 +134,25 @@ $(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) | |||
| 134 | check: $(TESTBIN) $(BINARY) | 134 | check: $(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. | ||
| 140 | CC_sanitize?=clang | ||
| 141 | CFLAGS_sanitize=$(CFLAGS_test) -fsanitize=address,undefined -fno-omit-frame-pointer | ||
| 142 | LDFLAGS_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 | |||
| 147 | check-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. |
| 141 | PYTHON?=python3 | 154 | PYTHON?=python3 |
| 142 | FEATURES_integration=$(FEATURES) -DWANT_IP_FROM_QUERY_STRING | 155 | FEATURES_integration=$(FEATURES) -DWANT_IP_FROM_QUERY_STRING -DWANT_ACCESSLIST_BLACK -DWANT_KEEPALIVE |
| 143 | CFLAGS_integration=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=address,undefined -fno-omit-frame-pointer | 156 | CFLAGS_integration=$(CFLAGS) $(OPTS_debug) $(FEATURES_integration) -fsanitize=address,undefined -fno-omit-frame-pointer |
| 144 | LDFLAGS_integration=$(LDFLAGS) -fsanitize=address,undefined | 157 | LDFLAGS_integration=$(LDFLAGS) -fsanitize=address,undefined |
| 145 | 158 | ||
| @@ -149,10 +162,18 @@ opentracker.integration: $(SOURCES) $(HEADERS) | |||
| 149 | check-integration: opentracker.integration | 162 | check-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. |
| 166 | check-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 | |||
| 173 | BINARIES=opentracker opentracker.debug opentracker.integration proxy proxy.debug $(TESTBIN) $(TESTBIN).sanitize | ||
| 153 | 174 | ||
| 154 | clean: | 175 | clean: |
| 155 | rm -rf opentracker opentracker.debug opentracker.integration proxy proxy.debug $(TESTBIN) *.o *~ | 176 | rm -rf $(BINARIES) $(BINARIES:=.dSYM) *.o *~ |
| 156 | 177 | ||
| 157 | install: | 178 | install: |
| 158 | install -m 755 opentracker $(DESTDIR)$(BINDIR) | 179 | install -m 755 opentracker $(DESTDIR)$(BINDIR) |
