aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-02-04 10:07:53 +0000
committerGitHub <noreply@github.com>2021-02-04 10:07:53 +0000
commit02dda3178812eaca7384a88f078233067ca3a2f1 (patch)
tree26e98c60ce090bab4be25cc6bf25a001217b2da9 /Makefile
parent8f464f0f52ac4c10b1c10376d26eddc644492966 (diff)
downloadlibvfio-user-02dda3178812eaca7384a88f078233067ca3a2f1.zip
libvfio-user-02dda3178812eaca7384a88f078233067ca3a2f1.tar.gz
libvfio-user-02dda3178812eaca7384a88f078233067ca3a2f1.tar.bz2
add AddressSanitizer run (#291)
Run unit tests with -fsanitize-address too. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile9
1 files changed, 9 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index f45d824..2baaee8 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,12 @@ else
CMAKE_BUILD_TYPE = Release
endif
+ifdef WITH_ASAN
+ CC = clang
+ CFLAGS += -fsanitize=address
+ LDFLAGS += -fsanitize=address
+endif
+
ifeq ($(VERBOSE),)
MAKEFLAGS += -s
endif
@@ -63,6 +69,8 @@ pre-push: realclean
make realclean
make test CC=clang
make test CC=clang BUILD_TYPE=rel
+ make realclean
+ make test WITH_ASAN=1
realclean:
rm -rf $(BUILD_DIR_BASE)
@@ -75,6 +83,7 @@ force_cmake: $(BUILD_DIR)/Makefile
$(BUILD_DIR)/Makefile:
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR); $(CMAKE) \
+ -D "CMAKE_C_COMPILER:STRING=$(CC)" \
-D "CMAKE_C_FLAGS:STRING=$(CFLAGS)" \
-D "CMAKE_BUILD_TYPE:STRING=$(CMAKE_BUILD_TYPE)" \
-D "CMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)" \