Commit 830912e2 authored by Ben Walker's avatar Ben Walker
Browse files

Add thread sanitizer to configure options



Change-Id: Ibeab0bc70bb59da4ebb8bd175642f5f549f1d273
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362425


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 675dc02b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
@@ -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
+5 −0
Original line number Diff line number Diff line
@@ -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