From 8da7a71a44bee4c63b778f8a62456cfe4e706b7c Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Wed, 22 Apr 2026 05:50:59 +0000 Subject: [PATCH] build(test): link ezoption_parser_unit-t / mysql_resolution_unit-t with WASAN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit obj/tap.o is compiled with $(OPT), which includes $(WASAN) = -fsanitize=address when WITHASAN=1. Every other unit test binary goes through the pattern rule on line 333 which re-applies $(OPT) on the link line, pulling in libasan. The two explicit rules for ezoption_parser_unit-t and mysql_resolution_unit-t were written without $(OPT) on the link step (they avoid linking libproxysql.a since they are standalone header-only tests), but they also dropped $(WASAN) — so the linker sees ASAN-instrumented tap.o and nothing to resolve __asan_report_*, __asan_init, __asan_handle_no_return, etc. against: /usr/bin/ld: obj/tap.o: undefined reference to `__asan_report_load8' ... (hundreds more) ... collect2: error: ld returned 1 exit status make[1]: *** [Makefile:321: ezoption_parser_unit-t] Error 1 Put $(WASAN) back on both link commands. CI-unit-tests-asan-coverage has been red on every branch (including v3.0 itself) since at least 2026-04-12 because of this. --- test/tap/tests/unit/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/tap/tests/unit/Makefile b/test/tap/tests/unit/Makefile index 71bc459ff..9e2b9f2c4 100644 --- a/test/tap/tests/unit/Makefile +++ b/test/tap/tests/unit/Makefile @@ -320,12 +320,12 @@ $(ODIR)/tap_noise_stubs.o: | $(ODIR) ezoption_parser_unit-t: ezoption_parser_unit-t.cpp $(ODIR)/tap.o $(ODIR)/tap_noise_stubs.o $(CXX) $< $(ODIR)/tap.o $(ODIR)/tap_noise_stubs.o \ -I$(TAP_IDIR) -I$(PROXYSQL_PATH)/include \ - $(STDCPP) -O0 -ggdb $(WGCOV) $(LWGCOV) -lpthread -o $@ + $(STDCPP) -O0 -ggdb $(WGCOV) $(LWGCOV) $(WASAN) -lpthread -o $@ mysql_resolution_unit-t: mysql_resolution_unit-t.cpp $(ODIR)/tap.o $(ODIR)/tap_noise_stubs.o $(CXX) $< $(ODIR)/tap.o $(ODIR)/tap_noise_stubs.o \ -I$(TAP_IDIR) -I$(PROXYSQL_PATH)/include \ - $(STDCPP) -O0 -ggdb $(WGCOV) $(LWGCOV) -lpthread -o $@ + $(STDCPP) -O0 -ggdb $(WGCOV) $(LWGCOV) $(WASAN) -lpthread -o $@ # Pattern rule: all unit tests use the same compile + link flags. # Each test binary is built from its .cpp source, linked against