test: add parse_common_script_args function

iscsi test scripts can now take two arguments -
"iso" and then the sock type (posix or vpp).  They
need to be in that specific order too.  nvmf test
scripts also support "iso" and we want to add
the transport type (rdma or tcp) as well.  Even further
out, we may want to use a sock type for nvmf, i.e.
tcp transport with vpp.

We also have the iscsi_tgt fio_remove_nvme.sh test
that does both iscsi and nvmf.

So to make this all work a bit nicer, add a new
function called parse_common_script_args that
will take the command line arguments to a script
and set the appropriate variables, including defaults
when a specific parameter isn't specified.  We will
use getopt-like behavior for this also, instead of
enforcing a specific parameter order.  Then a script
could be called like this:

test/nvmf/target/shutdown.sh --iso --transport=tcp --sock=vpp

Individual test scripts then just need to do this
after sourcing autotest_common.sh:

parse_common_script_args $@

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifb8d7666384991482a2d425e26ffa7525b9ac15a

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455283
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2019-05-16 16:50:48 -07:00
parent 98ef63aa23
commit 390b364146
24 changed files with 67 additions and 46 deletions

View File

@ -236,6 +236,23 @@ function timing_finish() {
fi
}
function parse_common_script_args() {
TEST_MODE=
for i in "$@"; do
case "$i" in
--iso)
TEST_MODE=iso
;;
--transport=*)
TEST_TRANSPORT="${i#*=}"
;;
--sock=*)
TEST_SOCK="${i#*=}"
;;
esac
done
}
function create_test_list() {
grep -rshI --exclude="autotest_common.sh" --exclude="$rootdir/test/common/autotest_common.sh" -e "report_test_completion" $rootdir | sed 's/report_test_completion//g; s/[[:blank:]]//g; s/"//g;' > $output_dir/all_tests.txt || true
}

View File

@ -5,8 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
parse_common_script_args $@
iscsitestinit $1 $2
timing_enter bdev_io_wait

5
test/nvmf/README.md Normal file
View File

@ -0,0 +1,5 @@
# NVMe-oF test scripts
The test scripts in this directory hierarchy can be run in isolation by passing
the --iso flag when running the test script. This will set up the RDMA NIC for
testing and then tear it back down again when the test is completed.

View File

@ -10,8 +10,6 @@ NVMF_TCP_IP_ADDRESS="127.0.0.1"
have_pci_nics=0
NVMF_TEST_MODE=$1
function load_ib_rdma_modules()
{
if [ `uname` != Linux ]; then
@ -159,7 +157,7 @@ function nvmfcleanup()
function nvmftestinit()
{
if [ "$NVMF_TEST_MODE" == "iso" ]; then
if [ "$TEST_MODE" == "iso" ]; then
$rootdir/scripts/setup.sh
rdma_device_init
fi
@ -185,7 +183,7 @@ function nvmfappstart()
function nvmftestfini()
{
killprocess $nvmfpid
if [ "$NVMF_TEST_MODE" == "iso" ]; then
if [ "$TEST_MODE" == "iso" ]; then
$rootdir/scripts/setup.sh reset
rdma_device_init
fi

View File

@ -5,12 +5,12 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
rpc_py="$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 ./aer.sh iso
nvmftestinit
RDMA_IP_LIST=$(get_available_rdma_ips)

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -12,8 +14,6 @@ rpc_py="$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 ./bdevperf.sh iso
nvmftestinit
RDMA_IP_LIST=$(get_available_rdma_ips)

View File

@ -6,12 +6,12 @@ source $rootdir/test/common/autotest_common.sh
source $rootdir/scripts/common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
rpc_py="$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
RDMA_IP_LIST=$(get_available_rdma_ips)

View File

@ -5,14 +5,14 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
rpc_py="$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 ./identify.sh iso
nvmftestinit
RDMA_IP_LIST=$(get_available_rdma_ips)

View File

@ -5,9 +5,9 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
set -e
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./identify_kernel_nvmf.sh iso
nvmftestinit
RDMA_IP_LIST=$(get_available_rdma_ips)

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -12,8 +14,6 @@ rpc_py="$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 ./perf.sh iso
nvmftestinit
RDMA_IP_LIST=$(get_available_rdma_ips)

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -13,8 +15,6 @@ rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter bdev_io_wait
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./bdev_io_wait.sh iso
nvmftestinit
nvmfappstart "-m 0xF --wait-for-rpc"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -13,8 +15,6 @@ rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter bdevio
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./bdev_io_wait.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -15,8 +17,6 @@ set -e
# connect disconnect is geared towards ensuring that we are properly freeing resources after disconnecting qpairs.
timing_enter connect_disconnect
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./filesystem.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
NULL_BDEV_SIZE=102400
NULL_BLOCK_SIZE=512
@ -18,8 +20,6 @@ if ! hash nvme; then
fi
timing_enter cr_trprt
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./crt_trprt.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
NULL_BDEV_SIZE=102400
NULL_BLOCK_SIZE=512
@ -18,8 +20,6 @@ if ! hash nvme; then
fi
timing_enter discovery
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./discovery.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -14,8 +16,6 @@ set -e
timing_enter fs_test
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./filesystem.sh iso
nvmftestinit
for incapsule in 0 4096; do

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -13,8 +15,6 @@ rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter fio
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./fio.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,8 +5,11 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
NVMF_SUBSYS=11
rpc_py="$rootdir/scripts/rpc.py"
@ -14,8 +17,6 @@ rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter multiconnection
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./multiconnection.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -13,8 +15,6 @@ rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter nmic
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./nmic.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
if [ -z "${DEPENDENCY_DIR}" ]; then
echo DEPENDENCY_DIR not defined!
exit 1
@ -20,8 +22,6 @@ rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter nvme_cli
# 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
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
LVOL_BDEV_INIT_SIZE=20
@ -15,8 +17,6 @@ rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter lvol_integrity
# 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
nvmfappstart "-m 0x7"

View File

@ -5,13 +5,13 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter rpc
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./rpc.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -37,8 +39,6 @@ function waitforio() {
}
timing_enter shutdown
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./shutdown.sh iso
nvmftestinit
nvmfappstart "-m 0xF"

View File

@ -5,6 +5,8 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
parse_common_script_args $@
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@ -13,8 +15,6 @@ rpc_py="$rootdir/scripts/rpc.py"
set -e
timing_enter srq_overwhelm
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./fio.sh iso
nvmftestinit
if check_ip_is_soft_roce $NVMF_FIRST_TARGET_IP; then