test/nvmf: make modprobe calls symmetric.

By moving the modprobe and modprobe -r calls into nvmftestinit and
nvmftestfini respectively, we can make these calls symmetric in all
cases The previous format where nvmfappstart was adding modules and
nvmfcleanup was being called independently to remove them started to
cause issues when we added the tcp transport.

I think this fixes #846

Change-Id: I68d18e0be5a2d4d2ea83a5a34f0aa2da268209fe
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460396
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Seth Howell 2019-07-03 17:51:10 -07:00 committed by Ben Walker
parent 0b8e0d81f2
commit 2df7e3a23d
17 changed files with 9 additions and 28 deletions

View File

@ -181,6 +181,13 @@ function nvmftestinit()
elif [ "$TEST_TRANSPORT" == "tcp" ]; then
NVMF_FIRST_TARGET_IP=127.0.0.1
fi
# currently we run the host/perf test for TCP even on systems without kernel nvme-tcp
# support; that's fine since the host/perf test uses the SPDK initiator
# maybe later we will enforce modprobe to succeed once we have systems in the test pool
# with nvme-tcp kernel support - but until then let this pass so we can still run the
# host/perf test with the tcp transport
modprobe nvme-$TEST_TRANSPORT || true
}
function nvmfappstart()
@ -190,17 +197,12 @@ function nvmfappstart()
nvmfpid=$!
trap "process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1" SIGINT SIGTERM EXIT
waitforlisten $nvmfpid
# currently we run the host/perf test for TCP even on systems without kernel nvme-tcp
# support; that's fine since the host/perf test uses the SPDK initiator
# maybe later we will enforce modprobe to succeed once we have systems in the test pool
# with nvme-tcp kernel support - but until then let this pass so we can still run the
# host/perf test with the tcp transport
modprobe nvme-$TEST_TRANSPORT || true
timing_exit start_nvmf_tgt
}
function nvmftestfini()
{
nvmfcleanup
killprocess $nvmfpid
if [ "$TEST_MODE" == "iso" ]; then
$rootdir/scripts/setup.sh reset

View File

@ -48,6 +48,5 @@ $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit aer

View File

@ -46,6 +46,5 @@ $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit bdev_io_wait

View File

@ -30,6 +30,5 @@ $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit bdev_io_wait

View File

@ -41,6 +41,5 @@ set -x
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit connect_disconnect

View File

@ -50,6 +50,5 @@ fi
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit crt_trprt

View File

@ -49,6 +49,5 @@ fi
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit discovery

View File

@ -68,7 +68,6 @@ for incapsule in 0 4096; do
trap - SIGINT SIGTERM EXIT
nvmfcleanup
killprocess $nvmfpid
done

View File

@ -63,7 +63,6 @@ nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true
if [ $fio_status -eq 0 ]; then
echo "nvmf hotplug test: fio successful - expected failure"
nvmfcleanup
nvmftestfini
exit 1
else
@ -78,6 +77,5 @@ rm -f ./local-job2-2-verify.state
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit fio

View File

@ -54,6 +54,5 @@ rm -f ./local-job0-0-verify.state
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit multiconnection

View File

@ -32,7 +32,6 @@ $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode2 Malloc0 || nmic_status=
if [ $nmic_status -eq 0 ]; then
echo " Adding namespace passed - failure expected."
nvmfcleanup
nvmftestfini
exit 1
else
@ -55,6 +54,5 @@ nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit nmic

View File

@ -73,7 +73,6 @@ fi
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
report_test_completion "nvmf_spdk_nvme_cli"
timing_exit nvme_cli

View File

@ -66,6 +66,5 @@ rm -f ./local-job*
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit lvol_integrity

View File

@ -66,7 +66,6 @@ vm_shutdown_all
trap - SIGINT SIGTERM EXIT
nvmfcleanup
killprocess $vhostpid
nvmftestfini
timing_exit nvmf_vhost

View File

@ -70,8 +70,6 @@ do
done
nvmfcleanup
# do frequent add delete.
for i in $(seq 1 $times)
do

View File

@ -116,7 +116,7 @@ waitforlisten $perfpid /var/tmp/bdevperf.sock
$rpc_py -s /var/tmp/bdevperf.sock wait_subsystem_init
# Expand the trap to clean up bdevperf if something goes wrong
trap "process_shm --id $NVMF_APP_SHM_ID; kill -9 $perfpid; nvmfcleanup; nvmftestfini; exit 1" SIGINT SIGTERM EXIT
trap "process_shm --id $NVMF_APP_SHM_ID; kill -9 $perfpid; nvmftestfini; exit 1" SIGINT SIGTERM EXIT
waitforio /var/tmp/bdevperf.sock Nvme1n1
@ -135,9 +135,6 @@ rm -rf $testdir/bdevperf.conf
rm -rf $testdir/rpcs.txt
trap - SIGINT SIGTERM EXIT
timing_enter cleanup
nvmfcleanup
timing_exit cleanup
timing_enter testfini
nvmftestfini
timing_exit testfini

View File

@ -48,6 +48,5 @@ done
trap - SIGINT SIGTERM EXIT
nvmfcleanup
nvmftestfini
timing_exit srq_overwhelm