Commit ee368e7b authored by Ziye Yang's avatar Ziye Yang Committed by Daniel Verkamp
Browse files

Autotest: Enable ASAN if there is asan lib



It seems that asan does not work well with:
(1) Valgrind. If asan is enabled, we do not use valgrind.
(2) Spdk fio plugin. If asan is enabled, we cannot work
with it even with the suggestion by using LD_preloads.
(3) Hotplug. If asan is enabled, it catches the SEGV earlier
than our defined handler

Change-Id: Id4bd5ae0f545aaba7d028e3da14fdddc18682429
Signed-off-by: default avatarZiye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/364917


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 90779f58
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -92,7 +92,12 @@ fi

if [ $SPDK_TEST_NVME -eq 1 ]; then
	run_test test/lib/nvme/nvme.sh
	# Only test hotplug without ASAN enabled. Since if it is
	# enabled, it catches SEGV earlier than our handler which
	# breaks the hotplug logic
	if [ $SPDK_RUN_ASAN -eq 0 ]; then
		run_test test/lib/nvme/hotplug.sh intel
	fi
	if [ $RUN_NIGHTLY -eq 1 ]; then
		run_test test/lib/nvme/nvmemp.sh
	fi
+10 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ fi
: ${SPDK_TEST_IOAT=1}; export SPDK_TEST_IOAT
: ${SPDK_TEST_EVENT=1}; export SPDK_TEST_EVENT
: ${SPDK_TEST_BLOBFS=1}; export SPDK_TEST_BLOBFS
: ${SPDK_RUN_ASAN=0}; export SPDK_RUN_ASAN

config_params='--enable-debug --enable-werror'

@@ -49,6 +50,13 @@ case `uname` in
		MAKEFLAGS=${MAKEFLAGS:--j$(nproc)}
		config_params+=' --enable-coverage'
		config_params+=' --enable-ubsan'
		if [ $SPDK_RUN_ASAN -eq 1 ]; then
			if /usr/sbin/ldconfig -p | grep -q asan; then
				config_params+=' --enable-asan'
			else
				SPDK_RUN_ASAN=0
			fi
		fi
		;;
	*)
		echo "Unknown OS in $0"
@@ -86,7 +94,8 @@ if [ -z "$output_dir" ]; then
	export output_dir
fi

if [ $SPDK_RUN_VALGRIND -eq 1 ] && hash valgrind &> /dev/null; then
# Valgrind does not work well when ASAN is enabled, so only use valgrind if ASAN is disabled
if [ $SPDK_RUN_ASAN -eq 0 ] && [ $SPDK_RUN_VALGRIND -eq 1 ] && hash valgrind &> /dev/null; then
	valgrind='valgrind --leak-check=full --error-exitcode=2'
else
	valgrind=''
+4 −1
Original line number Diff line number Diff line
@@ -71,7 +71,10 @@ PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin
if [ -d /usr/src/fio ]; then
	timing_enter fio_plugin
	for bdf in $(linux_iter_pci 0108); do
		# Only test when ASAN is not enabled. If ASAN is enabled, we cannot test.
		if [ $SPDK_RUN_ASAN -eq 0 ]; then
			LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/example_config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=1"
		fi
		break
	done