diff --git a/autotest.sh b/autotest.sh index 6434deef4..a1eb48b1b 100755 --- a/autotest.sh +++ b/autotest.sh @@ -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 diff --git a/scripts/autotest_common.sh b/scripts/autotest_common.sh index 9a6ea4141..8b698ee37 100755 --- a/scripts/autotest_common.sh +++ b/scripts/autotest_common.sh @@ -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='' diff --git a/test/lib/nvme/nvme.sh b/test/lib/nvme/nvme.sh index a52905f99..8a708498d 100755 --- a/test/lib/nvme/nvme.sh +++ b/test/lib/nvme/nvme.sh @@ -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