From 0fcf290ba2db320287163f142a83da0f9fe48b77 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Tue, 3 Nov 2026 02:40:38 +0100 Subject: Add integration tests for live sync --- Mk/tests.mk | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'Mk') diff --git a/Mk/tests.mk b/Mk/tests.mk index 46f308b..a7d4fbc 100644 --- a/Mk/tests.mk +++ b/Mk/tests.mk @@ -29,7 +29,13 @@ LDFLAGS_integration=$(LINK) -fsanitize=address,undefined CFLAGS_tsan=$(OPTS_debug) $(CPPFLAGS) $(OT_CFLAGS) $(FEATURES_integration) -fsanitize=thread -fno-omit-frame-pointer LDFLAGS_tsan=$(LINK) -fsanitize=thread -BINARIES+=$(TESTBIN) $(TESTBIN).poll $(TESTBIN).sanitize opentracker.integration opentracker.tsan +# Live sync is a compile time feature, so reaching it from a black box test +# needs a binary of its own. tests/integration/test_livesync.py skips itself +# against a build without it, which is what -v is for. +FEATURES_livesync=$(FEATURES_integration) -DWANT_SYNC_LIVE +CFLAGS_livesync=$(OPTS_debug) $(CPPFLAGS) $(OT_CFLAGS) $(FEATURES_livesync) -fsanitize=address,undefined -fno-omit-frame-pointer + +BINARIES+=$(TESTBIN) $(TESTBIN).poll $(TESTBIN).sanitize opentracker.integration opentracker.tsan opentracker.livesync $(TESTBIN): $(TEST_SOURCES) $(TEST_UNITS) $(TEST_HEADERS) $(BUILDDEPS) $(CC) -o $@ $(CFLAGS_test) $(TEST_SOURCES) $(TEST_UNITS) @@ -46,6 +52,9 @@ opentracker.integration: $(SOURCES) $(HEADERS) $(BUILDDEPS) opentracker.tsan: $(SOURCES) $(HEADERS) $(BUILDDEPS) $(CC) -o $@ $(CFLAGS_tsan) $(SOURCES) $(LDFLAGS_tsan) +opentracker.livesync: $(SOURCES) $(HEADERS) $(BUILDDEPS) + $(CC) -o $@ $(CFLAGS_livesync) $(SOURCES) $(LDFLAGS_integration) + check: $(TESTBIN) $(BINARY) ./$(TESTBIN) @@ -61,12 +70,19 @@ check-integration: opentracker.integration check-tsan: opentracker.tsan OPENTRACKER=./opentracker.tsan $(PYTHON) -m unittest discover -s tests/integration +# Only the live sync tests: a build with WANT_SYNC_LIVE refuses to start +# without a live sync address, so it cannot stand in for the plain binary in +# the rest of the suite. +check-livesync: opentracker.livesync + OPENTRACKER=./opentracker.livesync $(PYTHON) -m unittest discover -s tests/integration -p 'test_livesync.py' + # Cheapest first, so a quick failure comes back quickly. check-all: $(MAKE) check $(MAKE) check-poll $(MAKE) check-sanitize $(MAKE) check-integration + $(MAKE) check-livesync $(MAKE) check-tsan -.PHONY: check check-poll check-sanitize check-integration check-tsan check-all +.PHONY: check check-poll check-sanitize check-integration check-livesync check-tsan check-all -- cgit v1.3