test/bdev: Make sure cleanup() is always called upon exiting
This is mostly relevant for making sure the nvme drive used for gpt test is cleaned up. To that effect, replace dd with wipefs to make sure all signatures are wiped and kernel updated with the changes. Also, since gpt test is not supported on FreeBSD don't try to run it from autotest. Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: Ic970026363a6269f85b63e713f4187268fd6f923 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9290 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@gmail.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
84a9119bb0
commit
8419c294b4
@ -208,7 +208,9 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
|
||||
|
||||
if [ $SPDK_TEST_NVME -eq 1 ]; then
|
||||
run_test "blockdev_nvme" test/bdev/blockdev.sh "nvme"
|
||||
if [[ $(uname -s) == Linux ]]; then
|
||||
run_test "blockdev_nvme_gpt" test/bdev/blockdev.sh "gpt"
|
||||
fi
|
||||
run_test "nvme" test/nvme/nvme.sh
|
||||
if [[ $SPDK_TEST_NVME_PMR -eq 1 ]]; then
|
||||
run_test "nvme_pmr" test/nvme/nvme_pmr.sh
|
||||
|
@ -18,6 +18,13 @@ function cleanup() {
|
||||
if [[ $test_type == rbd ]]; then
|
||||
rbd_cleanup
|
||||
fi
|
||||
|
||||
if [[ "$test_type" = "gpt" ]]; then
|
||||
"$rootdir/scripts/setup.sh" reset
|
||||
if [[ -b $gpt_nvme ]]; then
|
||||
wipefs --all "$gpt_nvme"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function start_spdk_tgt() {
|
||||
@ -55,7 +62,6 @@ function setup_nvme_conf() {
|
||||
}
|
||||
|
||||
function setup_gpt_conf() {
|
||||
if [[ $(uname -s) = Linux ]] && hash sgdisk; then
|
||||
$rootdir/scripts/setup.sh reset
|
||||
# Get nvme devices by following drivers' links towards nvme class
|
||||
local nvme_devs=(/sys/bus/pci/drivers/nvme/*/nvme/nvme*/nvme*n*) nvme_dev
|
||||
@ -86,14 +92,6 @@ function setup_gpt_conf() {
|
||||
"$rootdir/scripts/setup.sh"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
# Not supported platform or missing tooling, nothing to be done, simply exit the test
|
||||
# in a graceful manner.
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
killprocess "$spdk_tgt_pid"
|
||||
cleanup
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_crypto_aesni_conf() {
|
||||
@ -139,7 +137,7 @@ function setup_rbd_conf() {
|
||||
function bdev_bounds() {
|
||||
$testdir/bdevio/bdevio -w -s $PRE_RESERVED_MEM --json "$conf_file" &
|
||||
bdevio_pid=$!
|
||||
trap 'killprocess $bdevio_pid; exit 1' SIGINT SIGTERM EXIT
|
||||
trap 'cleanup; killprocess $bdevio_pid; exit 1' SIGINT SIGTERM EXIT
|
||||
echo "Process bdevio pid: $bdevio_pid"
|
||||
waitforlisten $bdevio_pid
|
||||
$testdir/bdevio/tests.py perform_tests
|
||||
@ -171,7 +169,7 @@ function nbd_function_test() {
|
||||
modprobe nbd
|
||||
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 --json "$conf" &
|
||||
nbd_pid=$!
|
||||
trap 'killprocess $nbd_pid; exit 1' SIGINT SIGTERM EXIT
|
||||
trap 'cleanup; killprocess $nbd_pid; exit 1' SIGINT SIGTERM EXIT
|
||||
echo "Process nbd pid: $nbd_pid"
|
||||
waitforlisten $nbd_pid $rpc_server
|
||||
|
||||
@ -291,7 +289,7 @@ function qos_test_suite() {
|
||||
"$testdir/bdevperf/bdevperf" -z -m 0x2 -q 256 -o 4096 -w randread -t 60 &
|
||||
QOS_PID=$!
|
||||
echo "Process qos testing pid: $QOS_PID"
|
||||
trap 'killprocess $QOS_PID; exit 1' SIGINT SIGTERM EXIT
|
||||
trap 'cleanup; killprocess $QOS_PID; exit 1' SIGINT SIGTERM EXIT
|
||||
waitforlisten $QOS_PID
|
||||
|
||||
$rpc_py bdev_malloc_create -b $QOS_DEV_1 128 512
|
||||
@ -370,6 +368,8 @@ killprocess "$spdk_tgt_pid"
|
||||
# End bdev configuration
|
||||
#-----------------------------------------------------
|
||||
|
||||
trap "cleanup" SIGINT SIGTERM EXIT
|
||||
|
||||
run_test "bdev_hello_world" $SPDK_EXAMPLE_DIR/hello_bdev --json "$conf_file" -b "$hello_world_bdev"
|
||||
run_test "bdev_bounds" bdev_bounds
|
||||
run_test "bdev_nbd" nbd_function_test $conf_file "$bdevs_name"
|
||||
@ -385,6 +385,8 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap "cleanup" SIGINT SIGTERM EXIT
|
||||
|
||||
run_test "bdev_verify" $testdir/bdevperf/bdevperf --json "$conf_file" -q 128 -o 4096 -w verify -t 5 -C -m 0x3
|
||||
run_test "bdev_write_zeroes" $testdir/bdevperf/bdevperf --json "$conf_file" -q 128 -o 4096 -w write_zeroes -t 1
|
||||
|
||||
@ -399,11 +401,6 @@ fi
|
||||
|
||||
# Bdev and configuration cleanup below this line
|
||||
#-----------------------------------------------------
|
||||
if [ "$test_type" = "gpt" ]; then
|
||||
"$rootdir/scripts/setup.sh" reset
|
||||
if [[ -b $gpt_nvme ]]; then
|
||||
dd if=/dev/zero of="$gpt_nvme" bs=4096 count=8 oflag=direct
|
||||
fi
|
||||
fi
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
cleanup
|
||||
|
Loading…
Reference in New Issue
Block a user