Commit af7a9194 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

test/iscsi: inherit TEST_MODE from autotest_common.sh



Other common scripts for nvmf and vhost already used
TEST_MODE set by autotest_common.sh.
Meanwhile iscsi was processing it for each test script
separately.

This patch simplifies iscsitestinit/iscsitestfini
functions to just use TEST_MODE.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iacbdb552207eff72b41f2adb505e83348567df57
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3727


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 6ca184b0
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -5,9 +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.
iscsitestinit $1 $2
# $1 = test type posix or vpp. defaults to posix.
iscsitestinit $1

if [ -z "$TARGET_IP" ]; then
	echo "TARGET_IP not defined in environment"
@@ -57,7 +56,7 @@ $rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
$rpc_py iscsi_create_target_node disk1 disk1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 256 -d
sleep 1

trap 'killprocess $iscsipid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT
trap 'killprocess $iscsipid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT

$rootdir/test/app/fuzz/iscsi_fuzz/iscsi_fuzz -m 0xF0 -T $TARGET_IP -t $TEST_TIMEOUT 2> $output_dir/iscsi_autofuzz_logs.txt

@@ -70,6 +69,6 @@ trap - SIGINT SIGTERM EXIT

killprocess $iscsipid

iscsitestfini $1 $2
iscsitestfini $1

timing_exit iscsi_fuzz_test
+4 −4
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh

iscsitestinit $1 $2
iscsitestinit $1

MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
@@ -17,7 +17,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; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT
trap 'killprocess $pid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py iscsi_set_options -o 30 -a 4
# Minimal number of bdev io pool (5) and cache (1)
@@ -36,7 +36,7 @@ $rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
# "-d" ==> disable CHAP authentication
$rpc_py iscsi_create_target_node disk1 disk1_alias 'Malloc0:0' $PORTAL_TAG:$INITIATOR_TAG 256 -d
sleep 1
trap 'killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT
trap 'killprocess $pid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT

"$rootdir/test/bdev/bdevperf/bdevperf" --json <(initiator_json_config) -q 128 -o 4096 -w write -t 1
"$rootdir/test/bdev/bdevperf/bdevperf" --json <(initiator_json_config) -q 128 -o 4096 -w read -t 1
@@ -47,4 +47,4 @@ trap - SIGINT SIGTERM EXIT

killprocess $pid

iscsitestfini $1 $2
iscsitestfini $1
+6 −6
Original line number Diff line number Diff line
@@ -64,10 +64,10 @@ function cleanup_veth_interfaces() {
}

function iscsitestinit() {
	if [ "$1" == "iso" ]; then
	if [ "$TEST_MODE" == "iso" ]; then
		$rootdir/scripts/setup.sh
		if [ -n "$2" ]; then
			create_veth_interfaces $2
		if [ -n "$1" ]; then
			create_veth_interfaces $1
		else
			# default to posix
			create_veth_interfaces "posix"
@@ -91,9 +91,9 @@ function waitforiscsidevices() {
}

function iscsitestfini() {
	if [ "$1" == "iso" ]; then
		if [ -n "$2" ]; then
			cleanup_veth_interfaces $2
	if [ "$TEST_MODE" == "iso" ]; then
		if [ -n "$1" ]; then
			cleanup_veth_interfaces $1
		else
			# default to posix
			cleanup_veth_interfaces "posix"
+4 −5
Original line number Diff line number Diff line
@@ -5,9 +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.
iscsitestinit $1 $2
# $1 = test type posix or vpp. defaults to posix.
iscsitestinit $1

function node_login_fio_logout() {
	for arg in "$@"; do
@@ -57,7 +56,7 @@ timing_enter start_iscsi_tgt
pid=$!
echo "Process pid: $pid"

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

waitforlisten $pid
$rpc_py iscsi_set_options -o 30 -a 16
@@ -91,4 +90,4 @@ trap - SIGINT SIGTERM EXIT

iscsicleanup
killprocess $pid
iscsitestfini $1 $2
iscsitestfini $1
+5 −6
Original line number Diff line number Diff line
@@ -5,9 +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.
iscsitestinit $1 $2
# $1 = test type posix or vpp. defaults to posix.
iscsitestinit $1

rpc_py="$rootdir/scripts/rpc.py"
node_base="iqn.2013-06.com.intel.ch.spdk"
@@ -18,7 +17,7 @@ timing_enter start_iscsi_tgt
pid=$!
echo "Process pid: $pid"

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

waitforlisten $pid
$rpc_py iscsi_set_options -o 30 -a 4 -b $node_base
@@ -43,7 +42,7 @@ iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
waitforiscsidevices 1

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

echo "Test error injection"
$rpc_py bdev_error_inject_error EE_Malloc0 'all' 'failure' -n 1000
@@ -128,4 +127,4 @@ if [ -z "$NO_NVME" ]; then
fi

killprocess $pid
iscsitestfini $1 $2
iscsitestfini $1
Loading