Commit fdf5e585 authored by Seth Howell's avatar Seth Howell Committed by Jim Harris
Browse files

test/nvmf: add init and fini functions to tgt tests



These functions enable a user to run one of the Nvme-oF tests directly
from the command line without having to manually invoke all of the setup
we typically do.

Change-Id: Ib0baa77c08abb24c2fa2a1e21cf38ac613d663e0
Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/422336


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent edfde53d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -136,6 +136,22 @@ function nvmfcleanup()
	rmmod nvme-rdma
}

function nvmftestinit()
{
	if [ $1 == "iso" ]; then
		$rootdir/scripts/setup.sh
		rdma_device_init
	fi
}

function nvmftestfini()
{
	if [ $1 == "iso" ]; then
		$rootdir/scripts/setup.sh reset
		rdma_device_init
	fi
}

function rdma_device_init()
{
	load_ib_rdma_modules
+6 −1
Original line number Diff line number Diff line
@@ -12,6 +12,10 @@ rpc_py="python $rootdir/scripts/rpc.py"

set -e

# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./discovery.sh iso
nvmftestinit $1

if ! hash nvme; then
	echo "nvme command not found; skipping discovery test"
	exit 0
@@ -30,7 +34,7 @@ timing_enter start_nvmf_tgt
$NVMF_APP -m 0xF --wait-for-rpc &
nvmfpid=$!

trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT

waitforlisten $nvmfpid
$rpc_py set_nvmf_target_options -u 8192 -p 4
@@ -68,4 +72,5 @@ trap - SIGINT SIGTERM EXIT

nvmfcleanup
killprocess $nvmfpid
nvmftestfini $1
timing_exit discovery
+6 −1
Original line number Diff line number Diff line
@@ -12,6 +12,10 @@ rpc_py="python $rootdir/scripts/rpc.py"

set -e

# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./filesystem.sh iso
nvmftestinit $1

RDMA_IP_LIST=$(get_available_rdma_ips)
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
if [ -z $NVMF_FIRST_TARGET_IP ]; then
@@ -26,7 +30,7 @@ for incapsule in 0 4096; do
	$NVMF_APP -m 0xF --wait-for-rpc &
	nvmfpid=$!

	trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
	trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT

	waitforlisten $nvmfpid
	$rpc_py set_nvmf_target_options -u 8192 -p 4 -c $incapsule
@@ -87,4 +91,5 @@ for incapsule in 0 4096; do
	killprocess $nvmfpid
done

nvmftestfini $1
timing_exit fs_test
+6 −1
Original line number Diff line number Diff line
@@ -12,6 +12,10 @@ rpc_py="python $rootdir/scripts/rpc.py"

set -e

# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./fio.sh iso
nvmftestinit $1

RDMA_IP_LIST=$(get_available_rdma_ips)
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
if [ -z $NVMF_FIRST_TARGET_IP ]; then
@@ -25,7 +29,7 @@ timing_enter start_nvmf_tgt
$NVMF_APP -m 0xF --wait-for-rpc &
nvmfpid=$!

trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT

waitforlisten $nvmfpid
$rpc_py set_nvmf_target_options -u 8192 -p 4
@@ -90,5 +94,6 @@ rm -f ./local-job2-2-verify.state
trap - SIGINT SIGTERM EXIT

nvmfcleanup
nvmftestfini $1
killprocess $nvmfpid
timing_exit fio
+6 −1
Original line number Diff line number Diff line
@@ -22,6 +22,10 @@ function disconnect_nvmf()

set -e

# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./nvmf_lvol.sh iso
nvmftestinit $1

RDMA_IP_LIST=$(get_available_rdma_ips)
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
if [ -z $NVMF_FIRST_TARGET_IP ]; then
@@ -43,7 +47,7 @@ timing_enter start_nvmf_tgt
$NVMF_APP -m 0xF --wait-for-rpc &
pid=$!

trap "disconnect_nvmf; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "disconnect_nvmf; killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT

waitforlisten $pid
$rpc_py set_nvmf_target_options -u 8192 -p 4
@@ -97,4 +101,5 @@ trap - SIGINT SIGTERM EXIT

nvmfcleanup
killprocess $pid
nvmftestfini $1
timing_exit lvol_integrity
Loading