summaryrefslogtreecommitdiff
path: root/Mk/tests.mk
diff options
context:
space:
mode:
Diffstat (limited to 'Mk/tests.mk')
-rw-r--r--Mk/tests.mk23
1 files changed, 19 insertions, 4 deletions
diff --git a/Mk/tests.mk b/Mk/tests.mk
index 8e63839..2efdd72 100644
--- a/Mk/tests.mk
+++ b/Mk/tests.mk
@@ -5,13 +5,13 @@ BUILDDEPS+=Mk/tests.mk
5# the few symbols those modules reference but the tests never reach. 5# the few symbols those modules reference but the tests never reach.
6TESTBIN=tests/runner 6TESTBIN=tests/runner
7TEST_SOURCES=tests/runner.c tests/test.c tests/stubs.c tests/t_urlencoded.c tests/t_iovec.c tests/t_vector.c tests/t_random.c tests/t_hex.c tests/t_accesslist.c tests/t_scan.c tests/t_buf.c tests/t_ip.c tests/t_socket.c tests/t_mutex.c tests/t_trackerlogic.c tests/t_workqueue.c tests/t_batch.c tests/t_fdstate.c tests/t_event.c tests/t_fmt.c 7TEST_SOURCES=tests/runner.c tests/test.c tests/stubs.c tests/t_urlencoded.c tests/t_iovec.c tests/t_vector.c tests/t_random.c tests/t_hex.c tests/t_accesslist.c tests/t_scan.c tests/t_buf.c tests/t_ip.c tests/t_socket.c tests/t_mutex.c tests/t_trackerlogic.c tests/t_workqueue.c tests/t_batch.c tests/t_fdstate.c tests/t_event.c tests/t_fmt.c
8TEST_UNITS=ot_urlencoded.c ot_fmt.c ot_event.c ot_batch.c ot_fdstate.c ot_buf.c ot_ip.c ot_socket.c ot_iovec.c ot_vector.c ot_random.c ot_hex.c ot_scan.c ot_accesslist.c ot_mutex.c ot_workqueue.c trackerlogic.c 8TEST_UNITS=src/ot_urlencoded.c src/ot_fmt.c src/ot_event.c src/ot_batch.c src/ot_fdstate.c src/ot_buf.c src/ot_ip.c src/ot_socket.c src/ot_iovec.c src/ot_vector.c src/ot_random.c src/ot_hex.c src/ot_scan.c src/ot_accesslist.c src/ot_mutex.c src/ot_workqueue.c src/trackerlogic.c
9TEST_HEADERS=tests/test.h $(HEADERS) 9TEST_HEADERS=tests/test.h $(HEADERS)
10 10
11# A test binary is not a production binary, so it is built with the features 11# A test binary is not a production binary, so it is built with the features
12# the tests need to reach. 12# the tests need to reach.
13FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK -DWANT_SYNC_LIVE 13FEATURES_test=$(FEATURES) -DWANT_ACCESSLIST_BLACK -DWANT_SYNC_LIVE
14CFLAGS_test=-I. -g -O1 $(CPPFLAGS) $(OT_CFLAGS) $(FEATURES_test) 14CFLAGS_test=-Isrc -g -O1 $(CPPFLAGS) $(OT_CFLAGS) $(FEATURES_test)
15 15
16# clang over $(CC) because the two toolchains do not check the same things. 16# clang over $(CC) because the two toolchains do not check the same things.
17CC_sanitize?=clang 17CC_sanitize?=clang
@@ -29,7 +29,13 @@ LDFLAGS_integration=$(LINK) -fsanitize=address,undefined
29CFLAGS_tsan=$(OPTS_debug) $(CPPFLAGS) $(OT_CFLAGS) $(FEATURES_integration) -fsanitize=thread -fno-omit-frame-pointer 29CFLAGS_tsan=$(OPTS_debug) $(CPPFLAGS) $(OT_CFLAGS) $(FEATURES_integration) -fsanitize=thread -fno-omit-frame-pointer
30LDFLAGS_tsan=$(LINK) -fsanitize=thread 30LDFLAGS_tsan=$(LINK) -fsanitize=thread
31 31
32BINARIES+=$(TESTBIN) $(TESTBIN).poll $(TESTBIN).sanitize opentracker.integration opentracker.tsan 32# Live sync is a compile time feature, so reaching it from a black box test
33# needs a binary of its own. tests/integration/test_livesync.py skips itself
34# against a build without it, which is what -v is for.
35FEATURES_livesync=$(FEATURES_integration) -DWANT_SYNC_LIVE
36CFLAGS_livesync=$(OPTS_debug) $(CPPFLAGS) $(OT_CFLAGS) $(FEATURES_livesync) -fsanitize=address,undefined -fno-omit-frame-pointer
37
38BINARIES+=$(TESTBIN) $(TESTBIN).poll $(TESTBIN).sanitize opentracker.integration opentracker.tsan opentracker.livesync
33 39
34$(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) $(BUILDDEPS) 40$(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) $(BUILDDEPS)
35 $(CC) -o $@ $(CFLAGS_test) $(TEST_SOURCES) $(TEST_UNITS) 41 $(CC) -o $@ $(CFLAGS_test) $(TEST_SOURCES) $(TEST_UNITS)
@@ -46,6 +52,9 @@ opentracker.integration: $(SOURCES) $(HEADERS) $(BUILDDEPS)
46opentracker.tsan: $(SOURCES) $(HEADERS) $(BUILDDEPS) 52opentracker.tsan: $(SOURCES) $(HEADERS) $(BUILDDEPS)
47 $(CC) -o $@ $(CFLAGS_tsan) $(SOURCES) $(LDFLAGS_tsan) 53 $(CC) -o $@ $(CFLAGS_tsan) $(SOURCES) $(LDFLAGS_tsan)
48 54
55opentracker.livesync: $(SOURCES) $(HEADERS) $(BUILDDEPS)
56 $(CC) -o $@ $(CFLAGS_livesync) $(SOURCES) $(LDFLAGS_integration)
57
49check: $(TESTBIN) $(BINARY) 58check: $(TESTBIN) $(BINARY)
50 ./$(TESTBIN) 59 ./$(TESTBIN)
51 60
@@ -61,12 +70,18 @@ check-integration: opentracker.integration
61check-tsan: opentracker.tsan 70check-tsan: opentracker.tsan
62 OPENTRACKER=./opentracker.tsan $(PYTHON) -m unittest discover -s tests/integration 71 OPENTRACKER=./opentracker.tsan $(PYTHON) -m unittest discover -s tests/integration
63 72
73# The whole suite against a build that has live sync, which is also the only
74# way the live sync tests stop skipping.
75check-livesync: opentracker.livesync
76 OPENTRACKER=./opentracker.livesync $(PYTHON) -m unittest discover -s tests/integration
77
64# Cheapest first, so a quick failure comes back quickly. 78# Cheapest first, so a quick failure comes back quickly.
65check-all: 79check-all:
66 $(MAKE) check 80 $(MAKE) check
67 $(MAKE) check-poll 81 $(MAKE) check-poll
68 $(MAKE) check-sanitize 82 $(MAKE) check-sanitize
69 $(MAKE) check-integration 83 $(MAKE) check-integration
84 $(MAKE) check-livesync
70 $(MAKE) check-tsan 85 $(MAKE) check-tsan
71 86
72.PHONY: check check-poll check-sanitize check-integration check-tsan check-all 87.PHONY: check check-poll check-sanitize check-integration check-livesync check-tsan check-all