Commit 390b3641 authored by Jim Harris's avatar Jim Harris
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ifb8d7666384991482a2d425e26ffa7525b9ac15a

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455283


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 98ef63aa
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -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
}
+2 −2
Original line number Diff line number Diff line
@@ -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

test/nvmf/README.md

0 → 100644
+5 −0
Original line number Diff line number Diff line
# 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.
+2 −4
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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)
Loading