Add thread sanitizer to configure options

Change-Id: Ibeab0bc70bb59da4ebb8bd175642f5f549f1d273
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362425
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Ben Walker 2017-05-24 15:00:54 -07:00
parent 675dc02b81
commit 830912e28a
3 changed files with 22 additions and 0 deletions

3
CONFIG
View File

@ -49,6 +49,9 @@ CONFIG_ASAN?=n
# Build with Undefined Behavior Sanitizer enabled
CONFIG_UBSAN?=n
# Build with Thread Sanitizer enabled
CONFIG_TSAN?=n
# Directory that contains the desired SPDK environment library.
# By default, this is implemented using DPDK.
CONFIG_ENV?=$(SPDK_ROOT_DIR)/lib/env_dpdk

14
configure vendored
View File

@ -62,6 +62,12 @@ for i in "$@"; do
--disable-ubsan)
CONFIG_UBSAN=n
;;
--enable-tsan)
CONFIG_TSAN=y
;;
--disable-tsan)
CONFIG_TSAN=n
;;
--enable-coverage)
CONFIG_COVERAGE=y
;;
@ -132,6 +138,11 @@ if [ "$CONFIG_FIO_PLUGIN" = "y" ]; then
fi
fi
if [ "$CONFIG_ASAN" = "y" -a "$CONFIG_TSAN" = "y" ]; then
echo "ERROR: ASAN and TSAN cannot be enabled at the same time."
exit 1
fi
echo -n "Creating CONFIG.local..."
# Write the configuration file
@ -154,6 +165,9 @@ fi
if [ -n "$CONFIG_UBSAN" ]; then
echo "CONFIG_UBSAN?=$CONFIG_UBSAN" >> CONFIG.local
fi
if [ -n "$CONFIG_TSAN" ]; then
echo "CONFIG_TSAN?=$CONFIG_TSAN" >> CONFIG.local
fi
if [ -n "$CONFIG_ENV" ]; then
echo "CONFIG_ENV?=$CONFIG_ENV" >> CONFIG.local
fi

View File

@ -115,6 +115,11 @@ COMMON_CFLAGS += -fsanitize=undefined
LDFLAGS += -fsanitize=undefined
endif
ifeq ($(CONFIG_TSAN),y)
COMMON_CFLAGS += -fsanitize=thread
LDFLAGS += -fsanitize=thread
endif
COMMON_CFLAGS += -pthread
LDFLAGS += -pthread