autotest.sh: create cleanup function

This function consolidates cleanup behaviors that the pool should follow
in the event of a failure.

Change-Id: I8623f065146292b29a38eb199dcbeac5787723e7
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/401857
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2018-02-28 09:42:12 -07:00 committed by Jim Harris
parent 4dbff01ba3
commit d1f9da828a
2 changed files with 15 additions and 8 deletions

View File

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

View File

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