@@ -8,14 +8,6 @@ ifneq ($(filter coverage show-cov upload-cov,$(MAKECMDGOALS)),)
88COV =1
99endif
1010
11- ifneq ($(VG ) ,)
12- VALGRIND =$(VG )
13- endif
14-
15- ifeq ($(VALGRIND ) ,1)
16- override DEBUG ?= 1
17- endif
18-
1911ifeq ($(COV ) ,1)
2012override DEBUG ?= 1
2113CMAKE_COV += -DUSE_COVERAGE=ON
@@ -26,30 +18,18 @@ CMAKE_TESTS += -DVECSIM_BUILD_TESTS=off
2618endif
2719
2820ifneq ($(SAN ) ,)
29- override DEBUG ?= 1
30- export ASAN_OPTIONS=detect_odr_violation=0 :allocator_may_return_null=1
31- export MSAN_OPTIONS=allocator_may_return_null =1
3221
33- ifeq ($(SAN ) ,mem)
34- override SAN =memory
35- else ifeq ($(SAN),addr)
22+ ifeq ($(SAN ) ,address)
3623override SAN =address
37- endif
38-
39- ifeq ($(SAN ) ,memory)
40- CMAKE_SAN=-DUSE_MSAN =ON
41- override CTEST_ARGS += --exclude-regex BruteForceTest.sanity_rinsert_1280
42-
43- else ifeq ($(SAN),address)
24+ DEBUG =1
25+ export ASAN_OPTIONS=detect_odr_violation=0 :allocator_may_return_null=1
4426CMAKE_SAN=-DUSE_ASAN =ON
45- else ifeq ($(SAN),leak)
46- else ifeq ($(SAN),thread)
4727else
48- $(error SAN=mem|addr|leak|thread )
28+ $(error SAN=address is currently the only supported option )
4929endif
5030
5131export SAN
52- endif # SAN
32+ endif # SAN != ''
5333
5434ROOT =.
5535export ROOT
@@ -60,19 +40,18 @@ make build
6040 DEBUG=1 # build debug variant
6141 COV=1 # build for code coverage
6242 VERBOSE=1 # print detailed build info
63- VG|VALGRIND=1 # build for Valgrind
64- SAN=type # build with LLVM sanitizer (type=address|memory|leak|thread)
65- SLOW=1 # don't run build in parallel (for diagnostics)
66- PROFILE=1 # enable profiling compile flags (and debug symbols) for release type.
43+ SAN=address # build with AddressSanitizer (clang)
44+ SLOW=1 # don't run build in parallel (for diagnostics)
45+ PROFILE=1 # enable profiling compile flags (and debug symbols) for release type.
6746make pybind # build Python bindings
6847make clean # remove binary files
6948 ALL=1 # remove binary directories
7049
7150make unit_test # run unit tests
7251 CTEST_ARGS=args # extra CTest arguments
73- VG|VALGRIND=1 # run tests with valgrind
52+ SAN=address # run tests with AddressSanitizer
7453 FP_64=1 # run tests with 64-bit floating point
75- make valgrind # build for Valgrind and run tests
54+ make asan # build with AddressSanitizer and run unit tests
7655make flow_test # run flow tests (with pytest)
7756 TEST=file::name # run specific test
7857make mod_test # run Redis module intergration tests (with RLTest)
@@ -95,6 +74,11 @@ FLAVOR=debug
9574else
9675FLAVOR =release
9776endif
77+
78+ ifeq ($(SAN ) ,address)
79+ FLAVOR := ${FLAVOR}-asan
80+ endif
81+
9882FULL_VARIANT: =$(shell uname) -$(shell uname -m) -$(FLAVOR )
9983BINROOT =$(ROOT ) /bin/$(FULL_VARIANT )
10084BINDIR =$(BINROOT )
@@ -172,22 +156,18 @@ ifeq ($(VERBOSE),1)
172156_CTEST_ARGS += -V
173157endif
174158
175- ifeq ($(VALGRIND ) ,1)
176- _CTEST_ARGS += \
177- -T memcheck \
178- --overwrite MemoryCheckCommandOptions="--leak-check=full --error-exitcode=255"
179- endif
159+ # AddressSanitizer is handled via SAN=address in cmake/san.cmake
180160
181161unit_test :
182162 $(SHOW ) mkdir -p $(BINDIR )
183163 $(SHOW ) cd $(BINDIR ) && cmake $(CMAKE_FLAGS ) $(CMAKE_DIR )
184164 @make --no-print-directory -C $(BINDIR ) $(MAKE_J )
185165 $(SHOW ) cd $(TESTDIR ) && GTEST_COLOR=1 ctest $(_CTEST_ARGS )
186166
187- valgrind :
188- $(SHOW )$(MAKE ) VG=1 unit_test
167+ asan :
168+ $(SHOW )$(MAKE ) SAN=address unit_test
189169
190- .PHONY : unit_test valgrind
170+ .PHONY : unit_test asan
191171
192172# ----------------------------------------------------------------------------------------------
193173
0 commit comments