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

test/iscsi: enable iso testing.



This paradigm has made it so much easier to test NVMe-oF locally. Extend
it to the iscsi tests as much as possible.

There are a few exceptions to the rule right now. Namely, the calsoft,
perf, pmem, and rpc tests which need to be slightly refactored before
they are ready for isolation running.

Change-Id: I3e92bd340c6a499dc77a56eb67bc7b074604746c
Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453476


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 743081c2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@ 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.
iscsitestinit $1 $2

timing_enter bdev_io_wait

MALLOC_BDEV_SIZE=64
@@ -17,7 +21,7 @@ timing_enter start_iscsi_tgt
$ISCSI_APP -m 0x2 -p 1 -s 512 --wait-for-rpc &
pid=$!
echo "iSCSI target launched. pid: $pid"
trap "killprocess $pid;exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 4
# Minimal number of bdev io pool (5) and cache (1)
@@ -36,7 +40,7 @@ $rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
# "-d" ==> disable CHAP authentication
$rpc_py construct_target_node disk1 disk1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 256 -d
sleep 1
trap "killprocess $pid; rm -f $testdir/bdev.conf; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; rm -f $testdir/bdev.conf; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT

# Prepare config file for iSCSI initiator
echo "[iSCSI_Initiator]" > $testdir/bdev.conf
@@ -51,5 +55,6 @@ trap - SIGINT SIGTERM EXIT

killprocess $pid

iscsitestfini $1 $2
report_test_completion "bdev_io_wait"
timing_exit bdev_io_wait
+24 −0
Original line number Diff line number Diff line
@@ -51,3 +51,27 @@ function cleanup_veth_interfaces() {
	ip link delete $INITIATOR_INTERFACE
	ip netns del $TARGET_NAMESPACE
}

function iscsitestinit() {
	if [ "$1" == "iso" ]; then
		$rootdir/scripts/setup.sh
		if [ ! -z "$2" ]; then
			create_veth_interfaces $2
		else
			# default to posix
			create_veth_interfaces "posix"
		fi
	fi
}

function iscsitestfini() {
	if [ "$1" == "iso" ]; then
		if [ ! -z "$2" ]; then
			cleanup_veth_interfaces $2
		else
			# default to posix
			cleanup_veth_interfaces "posix"
		fi
		$rootdir/scripts/setup.sh reset
	fi
}
+6 −1
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@ 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.
iscsitestinit $1 $2

function node_login_fio_logout() {
	for arg in "$@"; do
		iscsiadm -m node -p $TARGET_IP:$ISCSI_PORT -o update -n node.conn[0].iscsi.$arg
@@ -67,7 +71,7 @@ $ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$!
echo "Process pid: $pid"

trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT

waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 16
@@ -101,4 +105,5 @@ trap - SIGINT SIGTERM EXIT

iscsicleanup
killprocess $pid
iscsitestfini $1 $2
timing_exit digests
+7 −2
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@ 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.
iscsitestinit $1 $2

timing_enter ext4test

rpc_py="$rootdir/scripts/rpc.py"
@@ -16,7 +20,7 @@ $ISCSI_APP --wait-for-rpc &
pid=$!
echo "Process pid: $pid"

trap "$rpc_py destruct_split_vbdev Name0n1 || true; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "$rpc_py destruct_split_vbdev Name0n1 || true; killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT

waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 4 -b $node_base
@@ -40,7 +44,7 @@ iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT

trap 'for new_dir in `dir -d /mnt/*dir`; do umount $new_dir; rm -rf $new_dir; done; \
	iscsicleanup; killprocess $pid; exit 1' SIGINT SIGTERM EXIT
	iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT

sleep 1

@@ -121,5 +125,6 @@ if [ -z "$NO_NVME" ]; then
fi

killprocess $pid
iscsitestfini $1 $2
report_test_completion "nightly_iscsi_ext4test"
timing_exit ext4test
+7 −2
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@ source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
source $rootdir/scripts/common.sh

# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2

timing_enter filesystem

rpc_py="$rootdir/scripts/rpc.py"
@@ -29,7 +33,7 @@ $ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc &
pid=$!
echo "Process pid: $pid"

trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT

waitforlisten $pid
$rpc_py set_iscsi_options -o 30 -a 16
@@ -61,7 +65,7 @@ sleep 1
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT

trap "remove_backends; umount /mnt/device; rm -rf /mnt/device; iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "remove_backends; umount /mnt/device; rm -rf /mnt/device; iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT

sleep 1

@@ -133,4 +137,5 @@ trap - SIGINT SIGTERM EXIT
iscsicleanup
remove_backends
killprocess $pid
iscsitestfini $1 $2
timing_exit filesystem
Loading