From af7a9194c0b0505e95704416f0ed0c03446afc20 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Tue, 11 Aug 2020 06:24:22 -0400 Subject: [PATCH] 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: Tomasz Zawadzki Change-Id: Iacbdb552207eff72b41f2adb505e83348567df57 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3727 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Paul Luse Reviewed-by: Shuhei Matsumoto --- test/fuzz/autofuzz_iscsi.sh | 9 ++++----- test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh | 8 ++++---- test/iscsi_tgt/common.sh | 12 ++++++------ test/iscsi_tgt/digests/digests.sh | 9 ++++----- test/iscsi_tgt/ext4test/ext4test.sh | 11 +++++------ test/iscsi_tgt/filesystem/filesystem.sh | 11 +++++------ test/iscsi_tgt/fio/fio.sh | 9 ++++----- test/iscsi_tgt/fuzz/fuzz.sh | 9 ++++----- test/iscsi_tgt/initiator/initiator.sh | 9 ++++----- test/iscsi_tgt/ip_migration/ip_migration.sh | 9 ++++----- test/iscsi_tgt/lvol/iscsi_lvol.sh | 9 ++++----- test/iscsi_tgt/multiconnection/multiconnection.sh | 9 ++++----- test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh | 13 ++++++------- test/iscsi_tgt/qos/qos.sh | 11 +++++------ test/iscsi_tgt/rbd/rbd.sh | 9 ++++----- test/iscsi_tgt/reset/reset.sh | 9 ++++----- test/iscsi_tgt/rpc_config/rpc_config.sh | 5 ++--- test/iscsi_tgt/sock/sock.sh | 11 +++++------ test/iscsi_tgt/trace_record/trace_record.sh | 13 ++++++------- 19 files changed, 84 insertions(+), 101 deletions(-) diff --git a/test/fuzz/autofuzz_iscsi.sh b/test/fuzz/autofuzz_iscsi.sh index 8793e8bf1..a06feb68b 100755 --- a/test/fuzz/autofuzz_iscsi.sh +++ b/test/fuzz/autofuzz_iscsi.sh @@ -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 diff --git a/test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh b/test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh index 15dfe1165..03b63a2f8 100755 --- a/test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh +++ b/test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh @@ -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 diff --git a/test/iscsi_tgt/common.sh b/test/iscsi_tgt/common.sh index d42a2a3a2..9ddfd10a5 100644 --- a/test/iscsi_tgt/common.sh +++ b/test/iscsi_tgt/common.sh @@ -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" diff --git a/test/iscsi_tgt/digests/digests.sh b/test/iscsi_tgt/digests/digests.sh index 3a03c10ec..8db040ea1 100755 --- a/test/iscsi_tgt/digests/digests.sh +++ b/test/iscsi_tgt/digests/digests.sh @@ -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 diff --git a/test/iscsi_tgt/ext4test/ext4test.sh b/test/iscsi_tgt/ext4test/ext4test.sh index 8de417367..365ebd40c 100755 --- a/test/iscsi_tgt/ext4test/ext4test.sh +++ b/test/iscsi_tgt/ext4test/ext4test.sh @@ -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 diff --git a/test/iscsi_tgt/filesystem/filesystem.sh b/test/iscsi_tgt/filesystem/filesystem.sh index 156b5bde3..0db88d466 100755 --- a/test/iscsi_tgt/filesystem/filesystem.sh +++ b/test/iscsi_tgt/filesystem/filesystem.sh @@ -6,9 +6,8 @@ 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 +# $1 = test type posix or vpp. defaults to posix. +iscsitestinit $1 rpc_py="$rootdir/scripts/rpc.py" # Remove lvol bdevs and stores. @@ -31,7 +30,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 @@ -64,7 +63,7 @@ iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT waitforiscsidevices 1 -trap 'iscsicleanup; remove_backends; umount /mnt/device; rm -rf /mnt/device; killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'iscsicleanup; remove_backends; umount /mnt/device; rm -rf /mnt/device; killprocess $pid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT mkdir -p /mnt/device @@ -142,4 +141,4 @@ trap - SIGINT SIGTERM EXIT iscsicleanup remove_backends killprocess $pid -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/fio/fio.sh b/test/iscsi_tgt/fio/fio.sh index ae3a2f308..3f59283cb 100755 --- a/test/iscsi_tgt/fio/fio.sh +++ b/test/iscsi_tgt/fio/fio.sh @@ -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 delete_tmp_files() { rm -f $testdir/iscsi2.json @@ -94,7 +93,7 @@ iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT waitforiscsidevices 2 -trap 'iscsicleanup; killprocess $pid; iscsitestfini $1 $2; delete_tmp_files; exit 1' SIGINT SIGTERM EXIT +trap 'iscsicleanup; killprocess $pid; iscsitestfini $1; delete_tmp_files; exit 1' SIGINT SIGTERM EXIT $fio_py -p iscsi -i 4096 -d 1 -t randrw -r 1 -v $fio_py -p iscsi -i 131072 -d 32 -t randrw -r 1 -v @@ -147,4 +146,4 @@ trap - SIGINT SIGTERM EXIT killprocess $pid -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/fuzz/fuzz.sh b/test/iscsi_tgt/fuzz/fuzz.sh index bc290fa8f..409c7976e 100755 --- a/test/iscsi_tgt/fuzz/fuzz.sh +++ b/test/iscsi_tgt/fuzz/fuzz.sh @@ -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" @@ -47,7 +46,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 30 2> $output_dir/iscsi_autofuzz_logs.txt @@ -60,6 +59,6 @@ trap - SIGINT SIGTERM EXIT killprocess $iscsipid -iscsitestfini $1 $2 +iscsitestfini $1 timing_exit iscsi_fuzz diff --git a/test/iscsi_tgt/initiator/initiator.sh b/test/iscsi_tgt/initiator/initiator.sh index 5da1f320b..75a4048a6 100755 --- a/test/iscsi_tgt/initiator/initiator.sh +++ b/test/iscsi_tgt/initiator/initiator.sh @@ -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 MALLOC_BDEV_SIZE=64 MALLOC_BLOCK_SIZE=512 @@ -36,7 +35,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 verify -t 5 -s 512 if [ $RUN_NIGHTLY -eq 1 ]; then @@ -49,4 +48,4 @@ trap - SIGINT SIGTERM EXIT killprocess $pid -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/ip_migration/ip_migration.sh b/test/iscsi_tgt/ip_migration/ip_migration.sh index d737e01b3..55c85be67 100755 --- a/test/iscsi_tgt/ip_migration/ip_migration.sh +++ b/test/iscsi_tgt/ip_migration/ip_migration.sh @@ -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" fio_py="$rootdir/scripts/fio.py" @@ -97,7 +96,7 @@ for ((i = 0; i < 2; i++)); do timing_exit start_iscsi_tgt_$i rpc_config $rpc_addr $NETMASK - trap 'kill_all_iscsi_target; iscsitestfini $1 $2; exit 1' \ + trap 'kill_all_iscsi_target; iscsitestfini $1; exit 1' \ SIGINT SIGTERM EXIT done @@ -128,4 +127,4 @@ trap - SIGINT SIGTERM EXIT iscsicleanup $rpc_py -s $rpc_second_addr spdk_kill_instance SIGTERM -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/lvol/iscsi_lvol.sh b/test/iscsi_tgt/lvol/iscsi_lvol.sh index e55899d56..749f166f5 100755 --- a/test/iscsi_tgt/lvol/iscsi_lvol.sh +++ b/test/iscsi_tgt/lvol/iscsi_lvol.sh @@ -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 MALLOC_BDEV_SIZE=128 MALLOC_BLOCK_SIZE=512 @@ -28,7 +27,7 @@ timing_enter start_iscsi_tgt pid=$! echo "Process pid: $pid" -trap 'iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'iscsicleanup; killprocess $pid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT waitforlisten $pid $rpc_py iscsi_set_options -o 30 -a 16 @@ -82,4 +81,4 @@ trap - SIGINT SIGTERM EXIT rm -f ./local-job* iscsicleanup killprocess $pid -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/multiconnection/multiconnection.sh b/test/iscsi_tgt/multiconnection/multiconnection.sh index badf70197..0c832cfe7 100755 --- a/test/iscsi_tgt/multiconnection/multiconnection.sh +++ b/test/iscsi_tgt/multiconnection/multiconnection.sh @@ -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" fio_py="$rootdir/scripts/fio.py" @@ -38,7 +37,7 @@ timing_enter start_iscsi_tgt "${ISCSI_APP[@]}" --wait-for-rpc & iscsipid=$! echo "iSCSI target launched. pid: $iscsipid" -trap 'remove_backends; iscsicleanup; killprocess $iscsipid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'remove_backends; iscsicleanup; killprocess $iscsipid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT waitforlisten $iscsipid $rpc_py iscsi_set_options -o 30 -a 128 @@ -81,4 +80,4 @@ rm -f ./local-job* iscsicleanup remove_backends killprocess $iscsipid -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh b/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh index 38329dc43..c1b170c8e 100755 --- a/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh +++ b/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh @@ -7,9 +7,8 @@ source $rootdir/test/nvmf/common.sh source $rootdir/test/iscsi_tgt/common.sh nvmftestinit -# $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" fio_py="$rootdir/scripts/fio.py" @@ -26,7 +25,7 @@ function run_nvme_remote() { "${ISCSI_APP[@]}" -r "$iscsi_rpc_addr" -m 0x1 -p 0 -s 512 --wait-for-rpc & iscsipid=$! echo "iSCSI target launched. pid: $iscsipid" - trap 'killprocess $iscsipid; iscsitestfini $1 $2; nvmftestfini; exit 1' SIGINT SIGTERM EXIT + trap 'killprocess $iscsipid; iscsitestfini $1; nvmftestfini; exit 1' SIGINT SIGTERM EXIT waitforlisten $iscsipid "$iscsi_rpc_addr" $rpc_py -s "$iscsi_rpc_addr" iscsi_set_options -o 30 -a 16 $rpc_py -s "$iscsi_rpc_addr" framework_start_init @@ -56,7 +55,7 @@ function run_nvme_remote() { "${NVMF_APP[@]}" -m 0x2 -p 1 -s 512 --wait-for-rpc & nvmfpid=$! echo "NVMf target launched. pid: $nvmfpid" -trap 'iscsitestfini $1 $2; nvmftestfini; exit 1' SIGINT SIGTERM EXIT +trap 'iscsitestfini $1; nvmftestfini; exit 1' SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py framework_start_init $rpc_py nvmf_create_transport -t RDMA -u 8192 @@ -74,7 +73,7 @@ timing_enter start_iscsi_tgt run_nvme_remote "local" trap 'iscsicleanup; killprocess $iscsipid; - rm -f ./local-job0-0-verify.state; iscsitestfini $1 $2; nvmftestfini; exit 1' SIGINT SIGTERM EXIT + rm -f ./local-job0-0-verify.state; iscsitestfini $1; nvmftestfini; exit 1' SIGINT SIGTERM EXIT echo "Running FIO" $fio_py -p iscsi -i 4096 -d 1 -t randrw -r 1 -v @@ -95,5 +94,5 @@ iscsicleanup killprocess $iscsipid $rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1 -iscsitestfini $1 $2 +iscsitestfini $1 nvmftestfini diff --git a/test/iscsi_tgt/qos/qos.sh b/test/iscsi_tgt/qos/qos.sh index 0a8015e18..1ff6efcf3 100755 --- a/test/iscsi_tgt/qos/qos.sh +++ b/test/iscsi_tgt/qos/qos.sh @@ -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 run_fio() { local bdev_name=$1 @@ -62,7 +61,7 @@ timing_enter start_iscsi_tgt "${ISCSI_APP[@]}" & 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 echo "iscsi_tgt is listening. Running tests..." @@ -81,7 +80,7 @@ sleep 1 iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT -trap 'iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'iscsicleanup; killprocess $pid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT # Run FIO without any QOS limits to determine the raw performance run_fio Malloc0 @@ -142,4 +141,4 @@ rm -f ./local-job0-0-verify.state trap - SIGINT SIGTERM EXIT killprocess $pid -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/rbd/rbd.sh b/test/iscsi_tgt/rbd/rbd.sh index 060cc7af0..41d83faaf 100755 --- a/test/iscsi_tgt/rbd/rbd.sh +++ b/test/iscsi_tgt/rbd/rbd.sh @@ -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 timing_enter rbd_setup rbd_setup $TARGET_IP $TARGET_NAMESPACE @@ -22,7 +21,7 @@ timing_enter start_iscsi_tgt "${ISCSI_APP[@]}" -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & pid=$! -trap 'killprocess $pid; rbd_cleanup; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'killprocess $pid; rbd_cleanup; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT waitforlisten $pid $rpc_py iscsi_set_options -o 30 -a 16 @@ -69,4 +68,4 @@ $rpc_py bdev_rbd_delete $rbd_bdev killprocess $pid rbd_cleanup -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/reset/reset.sh b/test/iscsi_tgt/reset/reset.sh index 406a10c45..929609ec0 100755 --- a/test/iscsi_tgt/reset/reset.sh +++ b/test/iscsi_tgt/reset/reset.sh @@ -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 MALLOC_BDEV_SIZE=64 MALLOC_BLOCK_SIZE=512 @@ -54,7 +53,7 @@ $fio_py -p iscsi -i 512 -d 1 -t read -r 60 & fiopid=$! echo "FIO pid: $fiopid" -trap 'iscsicleanup; killprocess $pid; killprocess $fiopid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'iscsicleanup; killprocess $pid; killprocess $fiopid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT # Do 3 resets while making sure iscsi_tgt and fio are still running for i in 1 2 3; do @@ -74,4 +73,4 @@ trap - SIGINT SIGTERM EXIT iscsicleanup killprocess $pid -iscsitestfini $1 $2 +iscsitestfini $1 diff --git a/test/iscsi_tgt/rpc_config/rpc_config.sh b/test/iscsi_tgt/rpc_config/rpc_config.sh index ce54b4ab2..347a5a172 100755 --- a/test/iscsi_tgt/rpc_config/rpc_config.sh +++ b/test/iscsi_tgt/rpc_config/rpc_config.sh @@ -6,8 +6,7 @@ source $rootdir/test/common/autotest_common.sh source $rootdir/test/iscsi_tgt/common.sh # $1 = test type posix or vpp. -# $2 = "iso" - triggers isolation mode (setting up required environment). -iscsitestinit $2 $1 +iscsitestinit $1 if [ "$1" == "posix" ] || [ "$1" == "vpp" ]; then TEST_TYPE=$1 @@ -60,4 +59,4 @@ trap - SIGINT SIGTERM EXIT iscsicleanup killprocess $pid -iscsitestfini $2 $1 +iscsitestfini $1 diff --git a/test/iscsi_tgt/sock/sock.sh b/test/iscsi_tgt/sock/sock.sh index 14615d3bc..ac21ebd96 100755 --- a/test/iscsi_tgt/sock/sock.sh +++ b/test/iscsi_tgt/sock/sock.sh @@ -62,9 +62,8 @@ function waitfortcp() { return $ret } -# $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 [ "$1" == "iso" ]; then TEST_TYPE=$2 @@ -96,7 +95,7 @@ echo "Testing client path" # start echo server using socat $SOCAT_APP tcp-l:$ISCSI_PORT,fork,bind=$INITIATOR_IP exec:'/bin/cat' & server_pid=$! -trap 'killprocess $server_pid;iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'killprocess $server_pid;iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT waitfortcp $server_pid $INITIATOR_IP:$ISCSI_PORT @@ -123,7 +122,7 @@ timing_enter sock_server # start echo server using hello_sock echo server $HELLO_SOCK_APP -H $TARGET_IP -P $ISCSI_PORT -S -N $TEST_TYPE & server_pid=$! -trap 'killprocess $server_pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'killprocess $server_pid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT waitforlisten $server_pid # send message to server using socat @@ -138,5 +137,5 @@ trap - SIGINT SIGTERM EXIT killprocess $server_pid -iscsitestfini $1 $2 +iscsitestfini $1 timing_exit sock_server diff --git a/test/iscsi_tgt/trace_record/trace_record.sh b/test/iscsi_tgt/trace_record/trace_record.sh index baa7f39d4..04fd06bd2 100755 --- a/test/iscsi_tgt/trace_record/trace_record.sh +++ b/test/iscsi_tgt/trace_record/trace_record.sh @@ -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 TRACE_TMP_FOLDER=./tmp-trace TRACE_RECORD_OUTPUT=${TRACE_TMP_FOLDER}/record.trace @@ -42,7 +41,7 @@ echo "start iscsi_tgt with trace enabled" iscsi_pid=$! echo "Process pid: $iscsi_pid" -trap 'killprocess $iscsi_pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'killprocess $iscsi_pid; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT waitforlisten $iscsi_pid @@ -73,7 +72,7 @@ iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT waitforiscsidevices $((CONNECTION_NUMBER + 1)) -trap 'iscsicleanup; killprocess $iscsi_pid; killprocess $record_pid; delete_tmp_files; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'iscsicleanup; killprocess $iscsi_pid; killprocess $record_pid; delete_tmp_files; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT echo "Running FIO" $fio_py -p iscsi -i 131072 -d 32 -t randrw -r 1 @@ -88,7 +87,7 @@ for i in $(seq 0 $CONNECTION_NUMBER); do done echo -e $RPCS | $rpc_py -trap 'delete_tmp_files; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT +trap 'delete_tmp_files; iscsitestfini $1; exit 1' SIGINT SIGTERM EXIT killprocess $iscsi_pid killprocess $record_pid @@ -132,4 +131,4 @@ for i in $(seq 0 $((len_arr_record_num - 1))); do done trap - SIGINT SIGTERM EXIT -iscsitestfini $1 $2 +iscsitestfini $1