diff --git a/autotest.sh b/autotest.sh index 613b834fa..f3de76e49 100755 --- a/autotest.sh +++ b/autotest.sh @@ -16,7 +16,7 @@ if [ $(uname -s) = Linux ]; then echo "core" > /proc/sys/kernel/core_pattern fi -trap "process_core; $rootdir/scripts/setup.sh reset; exit 1" SIGINT SIGTERM EXIT +trap "process_core; autotest_cleanup; exit 1" SIGINT SIGTERM EXIT timing_enter autotest @@ -205,13 +205,7 @@ if [ $SPDK_TEST_NVML -eq 1 ]; then fi timing_enter cleanup -if [ $SPDK_TEST_RBD -eq 1 ]; then - rbd_cleanup -fi -./scripts/setup.sh reset -if [ $SPDK_BUILD_IOAT_KMOD -eq 1 ]; then - ./scripts/build_kmod.sh clean -fi +autotest_cleanup timing_exit cleanup timing_exit autotest diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 37ce52b38..fdb1e4083 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -538,5 +538,18 @@ function get_bdev_size() echo "$bdev_size" } +function autotest_cleanup() +{ + if [ $SPDK_TEST_RBD -eq 1 ]; then + rbd_cleanup + fi + + $rootdir/scripts/setup.sh reset + + if [ $SPDK_BUILD_IOAT_KMOD -eq 1 ]; then + $rootdir/scripts/build_kmod.sh clean + fi +} + set -o errtrace trap "trap - ERR; print_backtrace >&2" ERR