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: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/364917
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Ziye Yang 2017-06-12 13:08:19 +08:00 committed by Daniel Verkamp
parent 90779f58c7
commit ee368e7b81
3 changed files with 20 additions and 3 deletions

View File

@ -92,7 +92,12 @@ fi
if [ $SPDK_TEST_NVME -eq 1 ]; then
run_test test/lib/nvme/nvme.sh
run_test test/lib/nvme/hotplug.sh intel
# 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

View File

@ -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=''

View File

@ -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
LD_PRELOAD=$PLUGIN_DIR/fio_plugin /usr/src/fio/fio $PLUGIN_DIR/example_config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=1"
# 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