]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add ASAN / LSAN options as appropriate
authorAlan T. DeKok <aland@freeradius.org>
Sun, 18 Apr 2021 13:42:12 +0000 (09:42 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 18 Apr 2021 14:45:49 +0000 (10:45 -0400)
so that "make test" on OSX doesn't have endless complaints about
leaks in libc

src/tests/all.mk
src/tests/unit/all.mk

index 319e6cd185e7e15222b3c4c5b62cbf050245f276..4c6004813754bf32d51ae3668fa565dede3ecd09 100644 (file)
@@ -83,6 +83,20 @@ ci-test: raddb/test.conf test
 #  Or, if we're trying to clean things up.
 #
 ifneq "$(findstring test,$(MAKECMDGOALS))$(findstring clean,$(MAKECMDGOALS))" ""
+
+#
+#  Add LSAN / ASAN options.  And shut them up on OSX, which has leaks in libc.
+#
+ifneq "$(findstring leak,$(CFLAGS))" ""
+export ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer)
+export ASAN_OPTIONS="malloc_context_size=50 detect_leaks=1 symbolize=1"
+ifneq "$(findstring apple,$(AC_HOSTINFO))" ""
+export LSAN_OPTIONS=print_suppressions=0 fast_unwind_on_malloc=0 suppressions=${top_srcdir}/scripts/build/lsan_leaks_osx
+else
+export LSAN_OPTIONS=print_suppressions=0 fast_unwind_on_malloc=0
+endif
+endif
+
 SUBMAKEFILES := rbmonkey.mk $(subst src/tests/,,$(wildcard src/tests/*/all.mk))
 endif
 
index f3e31ee6e0d2ef3d31f3e4ece4327354e9b01f4d..e98ed2edf5d1fbe9b3b90a5be89ef875f15e91c1 100644 (file)
@@ -53,10 +53,6 @@ $(foreach x,$(PROTOCOLS),$(eval $(call UNIT_TEST_PROTOCOLS,$x)))
 #  This is useful, too
 test.unit.condition: $(addprefix $(OUTPUT)/,$(filter condition/%.txt,$(FILES))) $(BUILD_DIR)/lib/libfreeradius-server.la
 
-#export ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer)
-#export ASAN_OPTIONS=malloc_context_size=50 detect_leaks=1 symbolize=1
-#export LSAN_OPTIONS=print_suppressions=0 fast_unwind_on_malloc=0
-
 #
 #  And the actual script to run each test.
 #