diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 17 |
1 files changed, 15 insertions, 2 deletions
| @@ -134,6 +134,19 @@ $(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 |
| @@ -149,10 +162,10 @@ 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 | .PHONY: all check check-sanitize check-integration clean install |
| 153 | 166 | ||
| 154 | clean: | 167 | clean: |
| 155 | rm -rf opentracker opentracker.debug opentracker.integration proxy proxy.debug $(TESTBIN) *.o *~ | 168 | rm -rf opentracker opentracker.debug opentracker.integration proxy proxy.debug $(TESTBIN) $(TESTBIN).sanitize *.o *~ |
| 156 | 169 | ||
| 157 | install: | 170 | install: |
| 158 | install -m 755 opentracker $(DESTDIR)$(BINDIR) | 171 | install -m 755 opentracker $(DESTDIR)$(BINDIR) |
