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:
parent
edfde53def
commit
fdf5e5854b
@ -136,6 +136,22 @@ function nvmfcleanup()
|
|||||||
rmmod nvme-rdma
|
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()
|
function rdma_device_init()
|
||||||
{
|
{
|
||||||
load_ib_rdma_modules
|
load_ib_rdma_modules
|
||||||
|
@ -12,6 +12,10 @@ rpc_py="python $rootdir/scripts/rpc.py"
|
|||||||
|
|
||||||
set -e
|
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
|
if ! hash nvme; then
|
||||||
echo "nvme command not found; skipping discovery test"
|
echo "nvme command not found; skipping discovery test"
|
||||||
exit 0
|
exit 0
|
||||||
@ -30,7 +34,7 @@ timing_enter start_nvmf_tgt
|
|||||||
$NVMF_APP -m 0xF --wait-for-rpc &
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
||||||
nvmfpid=$!
|
nvmfpid=$!
|
||||||
|
|
||||||
trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
|
trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
waitforlisten $nvmfpid
|
waitforlisten $nvmfpid
|
||||||
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
||||||
@ -68,4 +72,5 @@ trap - SIGINT SIGTERM EXIT
|
|||||||
|
|
||||||
nvmfcleanup
|
nvmfcleanup
|
||||||
killprocess $nvmfpid
|
killprocess $nvmfpid
|
||||||
|
nvmftestfini $1
|
||||||
timing_exit discovery
|
timing_exit discovery
|
||||||
|
@ -12,6 +12,10 @@ rpc_py="python $rootdir/scripts/rpc.py"
|
|||||||
|
|
||||||
set -e
|
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)
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
||||||
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
||||||
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
||||||
@ -26,7 +30,7 @@ for incapsule in 0 4096; do
|
|||||||
$NVMF_APP -m 0xF --wait-for-rpc &
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
||||||
nvmfpid=$!
|
nvmfpid=$!
|
||||||
|
|
||||||
trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
|
trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
waitforlisten $nvmfpid
|
waitforlisten $nvmfpid
|
||||||
$rpc_py set_nvmf_target_options -u 8192 -p 4 -c $incapsule
|
$rpc_py set_nvmf_target_options -u 8192 -p 4 -c $incapsule
|
||||||
@ -87,4 +91,5 @@ for incapsule in 0 4096; do
|
|||||||
killprocess $nvmfpid
|
killprocess $nvmfpid
|
||||||
done
|
done
|
||||||
|
|
||||||
|
nvmftestfini $1
|
||||||
timing_exit fs_test
|
timing_exit fs_test
|
||||||
|
@ -12,6 +12,10 @@ rpc_py="python $rootdir/scripts/rpc.py"
|
|||||||
|
|
||||||
set -e
|
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)
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
||||||
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
||||||
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
||||||
@ -25,7 +29,7 @@ timing_enter start_nvmf_tgt
|
|||||||
$NVMF_APP -m 0xF --wait-for-rpc &
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
||||||
nvmfpid=$!
|
nvmfpid=$!
|
||||||
|
|
||||||
trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
|
trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
waitforlisten $nvmfpid
|
waitforlisten $nvmfpid
|
||||||
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
$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
|
trap - SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
nvmfcleanup
|
nvmfcleanup
|
||||||
|
nvmftestfini $1
|
||||||
killprocess $nvmfpid
|
killprocess $nvmfpid
|
||||||
timing_exit fio
|
timing_exit fio
|
||||||
|
@ -22,6 +22,10 @@ function disconnect_nvmf()
|
|||||||
|
|
||||||
set -e
|
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)
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
||||||
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
||||||
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
||||||
@ -43,7 +47,7 @@ timing_enter start_nvmf_tgt
|
|||||||
$NVMF_APP -m 0xF --wait-for-rpc &
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
||||||
pid=$!
|
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
|
waitforlisten $pid
|
||||||
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
||||||
@ -97,4 +101,5 @@ trap - SIGINT SIGTERM EXIT
|
|||||||
|
|
||||||
nvmfcleanup
|
nvmfcleanup
|
||||||
killprocess $pid
|
killprocess $pid
|
||||||
|
nvmftestfini $1
|
||||||
timing_exit lvol_integrity
|
timing_exit lvol_integrity
|
||||||
|
@ -13,6 +13,10 @@ rpc_py="python $rootdir/scripts/rpc.py"
|
|||||||
|
|
||||||
set -e
|
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)
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
||||||
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
||||||
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
||||||
@ -34,7 +38,7 @@ timing_enter start_nvmf_tgt
|
|||||||
$NVMF_APP -m 0xF --wait-for-rpc &
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
||||||
pid=$!
|
pid=$!
|
||||||
|
|
||||||
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
|
trap "killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
waitforlisten $pid
|
waitforlisten $pid
|
||||||
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
||||||
@ -71,4 +75,5 @@ trap - SIGINT SIGTERM EXIT
|
|||||||
|
|
||||||
nvmfcleanup
|
nvmfcleanup
|
||||||
killprocess $pid
|
killprocess $pid
|
||||||
|
nvmftestfini $1
|
||||||
timing_exit multiconnection
|
timing_exit multiconnection
|
||||||
|
@ -19,6 +19,10 @@ rpc_py="python $rootdir/scripts/rpc.py"
|
|||||||
|
|
||||||
set -e
|
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)
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
||||||
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
||||||
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
||||||
@ -31,7 +35,7 @@ timing_enter start_nvmf_tgt
|
|||||||
$NVMF_APP -m 0xF --wait-for-rpc &
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
||||||
nvmfpid=$!
|
nvmfpid=$!
|
||||||
|
|
||||||
trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
|
trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
waitforlisten $nvmfpid
|
waitforlisten $nvmfpid
|
||||||
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
||||||
@ -86,5 +90,6 @@ trap - SIGINT SIGTERM EXIT
|
|||||||
|
|
||||||
nvmfcleanup
|
nvmfcleanup
|
||||||
killprocess $nvmfpid
|
killprocess $nvmfpid
|
||||||
|
nvmftestfini $1
|
||||||
report_test_completion "nvmf_spdk_nvme_cli"
|
report_test_completion "nvmf_spdk_nvme_cli"
|
||||||
timing_exit nvme_cli
|
timing_exit nvme_cli
|
||||||
|
@ -9,6 +9,10 @@ rpc_py="python $rootdir/scripts/rpc.py"
|
|||||||
|
|
||||||
set -e
|
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)
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
||||||
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
||||||
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
||||||
@ -22,7 +26,7 @@ timing_enter start_nvmf_tgt
|
|||||||
$NVMF_APP -m 0xF --wait-for-rpc &
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
||||||
pid=$!
|
pid=$!
|
||||||
|
|
||||||
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
|
trap "killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
waitforlisten $pid
|
waitforlisten $pid
|
||||||
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
||||||
@ -133,4 +137,5 @@ done
|
|||||||
trap - SIGINT SIGTERM EXIT
|
trap - SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
killprocess $pid
|
killprocess $pid
|
||||||
|
nvmftestfini $1
|
||||||
timing_exit rpc
|
timing_exit rpc
|
||||||
|
@ -12,6 +12,10 @@ rpc_py="python $rootdir/scripts/rpc.py"
|
|||||||
|
|
||||||
set -e
|
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)
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
||||||
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
||||||
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
||||||
@ -25,7 +29,7 @@ timing_enter start_nvmf_tgt
|
|||||||
$NVMF_APP -m 0xF --wait-for-rpc &
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
||||||
pid=$!
|
pid=$!
|
||||||
|
|
||||||
trap "killprocess $pid; nvmfcleanup; exit 1" SIGINT SIGTERM EXIT
|
trap "killprocess $pid; nvmfcleanup; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
||||||
|
|
||||||
waitforlisten $pid
|
waitforlisten $pid
|
||||||
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
$rpc_py set_nvmf_target_options -u 8192 -p 4
|
||||||
@ -63,4 +67,5 @@ trap - SIGINT SIGTERM EXIT
|
|||||||
killprocess $pid
|
killprocess $pid
|
||||||
|
|
||||||
nvmfcleanup
|
nvmfcleanup
|
||||||
|
nvmftestfini $1
|
||||||
timing_exit shutdown
|
timing_exit shutdown
|
||||||
|
Loading…
Reference in New Issue
Block a user