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: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/422336
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Seth Howell 2018-08-14 11:05:15 -07:00 committed by Jim Harris
parent edfde53def
commit fdf5e5854b
9 changed files with 64 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,6 +13,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 ./multiconnection.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
@ -34,7 +38,7 @@ timing_enter start_nvmf_tgt
$NVMF_APP -m 0xF --wait-for-rpc &
pid=$!
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_nvmf_target_options -u 8192 -p 4
@ -71,4 +75,5 @@ trap - SIGINT SIGTERM EXIT
nvmfcleanup
killprocess $pid
nvmftestfini $1
timing_exit multiconnection

View File

@ -19,6 +19,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 ./nvme_cli.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
@ -31,7 +35,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
@ -86,5 +90,6 @@ trap - SIGINT SIGTERM EXIT
nvmfcleanup
killprocess $nvmfpid
nvmftestfini $1
report_test_completion "nvmf_spdk_nvme_cli"
timing_exit nvme_cli

View File

@ -9,6 +9,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 ./rpc.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
@ -22,7 +26,7 @@ timing_enter start_nvmf_tgt
$NVMF_APP -m 0xF --wait-for-rpc &
pid=$!
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_nvmf_target_options -u 8192 -p 4
@ -133,4 +137,5 @@ done
trap - SIGINT SIGTERM EXIT
killprocess $pid
nvmftestfini $1
timing_exit rpc

View File

@ -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 ./shutdown.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 &
pid=$!
trap "killprocess $pid; nvmfcleanup; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; nvmfcleanup; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_nvmf_target_options -u 8192 -p 4
@ -63,4 +67,5 @@ trap - SIGINT SIGTERM EXIT
killprocess $pid
nvmfcleanup
nvmftestfini $1
timing_exit shutdown