From 03b9841dd9da1a820417cc7a161446b82559c98d Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Mon, 6 May 2019 15:46:30 -0700 Subject: [PATCH] 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: Seth Howell Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453476 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh | 9 +++++-- test/iscsi_tgt/common.sh | 24 +++++++++++++++++++ test/iscsi_tgt/digests/digests.sh | 7 +++++- test/iscsi_tgt/ext4test/ext4test.sh | 9 +++++-- test/iscsi_tgt/filesystem/filesystem.sh | 9 +++++-- test/iscsi_tgt/fio/fio.sh | 8 ++++++- test/iscsi_tgt/initiator/initiator.sh | 7 +++++- test/iscsi_tgt/ip_migration/ip_migration.sh | 7 +++++- test/iscsi_tgt/lvol/iscsi_lvol.sh | 7 +++++- .../multiconnection/multiconnection.sh | 7 +++++- test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh | 13 +++++++--- test/iscsi_tgt/qos/qos.sh | 9 +++++-- test/iscsi_tgt/rbd/rbd.sh | 7 +++++- test/iscsi_tgt/reset/reset.sh | 7 +++++- test/iscsi_tgt/sock/sock.sh | 9 +++++-- test/iscsi_tgt/trace_record/trace_record.sh | 11 ++++++--- 16 files changed, 126 insertions(+), 24 deletions(-) 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 4d60cb2ae..716070caa 100755 --- a/test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh +++ b/test/iscsi_tgt/bdev_io_wait/bdev_io_wait.sh @@ -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 diff --git a/test/iscsi_tgt/common.sh b/test/iscsi_tgt/common.sh index ca85518bd..9fc818b9e 100644 --- a/test/iscsi_tgt/common.sh +++ b/test/iscsi_tgt/common.sh @@ -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 +} diff --git a/test/iscsi_tgt/digests/digests.sh b/test/iscsi_tgt/digests/digests.sh index 504bf6389..a36c40faa 100755 --- a/test/iscsi_tgt/digests/digests.sh +++ b/test/iscsi_tgt/digests/digests.sh @@ -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 diff --git a/test/iscsi_tgt/ext4test/ext4test.sh b/test/iscsi_tgt/ext4test/ext4test.sh index 6b119c7ce..7350ec1eb 100755 --- a/test/iscsi_tgt/ext4test/ext4test.sh +++ b/test/iscsi_tgt/ext4test/ext4test.sh @@ -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 diff --git a/test/iscsi_tgt/filesystem/filesystem.sh b/test/iscsi_tgt/filesystem/filesystem.sh index 0c530b3b0..bc1f8c7cd 100755 --- a/test/iscsi_tgt/filesystem/filesystem.sh +++ b/test/iscsi_tgt/filesystem/filesystem.sh @@ -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 diff --git a/test/iscsi_tgt/fio/fio.sh b/test/iscsi_tgt/fio/fio.sh index f18a5c32f..51edfd30c 100755 --- a/test/iscsi_tgt/fio/fio.sh +++ b/test/iscsi_tgt/fio/fio.sh @@ -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 + delete_tmp_files() { rm -f $testdir/iscsi2.json rm -f ./local-job0-0-verify.state @@ -89,7 +93,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; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT +trap "iscsicleanup; killprocess $pid; iscsitestfini $1 $2; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT sleep 1 $fio_py iscsi 4096 1 randrw 1 1 verify @@ -139,4 +143,6 @@ trap - SIGINT SIGTERM EXIT killprocess $pid +iscsitestfini $1 $2 + timing_exit fio diff --git a/test/iscsi_tgt/initiator/initiator.sh b/test/iscsi_tgt/initiator/initiator.sh index 7ab95415a..5966a495b 100755 --- a/test/iscsi_tgt/initiator/initiator.sh +++ b/test/iscsi_tgt/initiator/initiator.sh @@ -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 initiator MALLOC_BDEV_SIZE=64 @@ -34,7 +38,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 "iscsi_initiator" timing_exit initiator diff --git a/test/iscsi_tgt/ip_migration/ip_migration.sh b/test/iscsi_tgt/ip_migration/ip_migration.sh index 730cfabf1..5059652df 100755 --- a/test/iscsi_tgt/ip_migration/ip_migration.sh +++ b/test/iscsi_tgt/ip_migration/ip_migration.sh @@ -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 + rpc_py="$rootdir/scripts/rpc.py" fio_py="$rootdir/scripts/fio.py" @@ -57,7 +61,7 @@ for ((i = 0; i < 2; i++)); do timing_exit start_iscsi_tgt_$i rpc_config $rpc_addr $NETMASK - trap "kill_all_iscsi_target; exit 1" \ + trap "kill_all_iscsi_target; iscsitestfini $1 $2; exit 1" \ SIGINT SIGTERM EXIT done @@ -87,5 +91,6 @@ trap - SIGINT SIGTERM EXIT iscsicleanup $rpc_py -s $rpc_second_addr kill_instance SIGTERM +iscsitestfini $1 $2 report_test_completion "iscsi_ip_migration" timing_exit ip_migration diff --git a/test/iscsi_tgt/lvol/iscsi_lvol.sh b/test/iscsi_tgt/lvol/iscsi_lvol.sh index 84ea8fd7f..e7892f17d 100755 --- a/test/iscsi_tgt/lvol/iscsi_lvol.sh +++ b/test/iscsi_tgt/lvol/iscsi_lvol.sh @@ -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 iscsi_lvol MALLOC_BDEV_SIZE=128 @@ -26,7 +30,7 @@ $ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & pid=$! echo "Process pid: $pid" -trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT +trap "iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid $rpc_py set_iscsi_options -o 30 -a 16 @@ -79,4 +83,5 @@ trap - SIGINT SIGTERM EXIT rm -f ./local-job* iscsicleanup killprocess $pid +iscsitestfini $1 $2 timing_exit iscsi_lvol diff --git a/test/iscsi_tgt/multiconnection/multiconnection.sh b/test/iscsi_tgt/multiconnection/multiconnection.sh index 14a6c7bdb..7b4e64aa6 100755 --- a/test/iscsi_tgt/multiconnection/multiconnection.sh +++ b/test/iscsi_tgt/multiconnection/multiconnection.sh @@ -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 + rpc_py="$rootdir/scripts/rpc.py" fio_py="$rootdir/scripts/fio.py" @@ -37,7 +41,7 @@ timing_enter start_iscsi_tgt $ISCSI_APP --wait-for-rpc & iscsipid=$! echo "iSCSI target launched. pid: $iscsipid" -trap "remove_backends; iscsicleanup; killprocess $iscsipid; exit 1" SIGINT SIGTERM EXIT +trap "remove_backends; iscsicleanup; killprocess $iscsipid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT waitforlisten $iscsipid $rpc_py set_iscsi_options -o 30 -a 128 @@ -80,4 +84,5 @@ rm -f ./local-job* iscsicleanup remove_backends killprocess $iscsipid +iscsitestfini $1 $2 timing_exit multiconnection diff --git a/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh b/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh index 6b4e8f55d..3d8b82c66 100755 --- a/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh +++ b/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh @@ -8,6 +8,11 @@ source $rootdir/test/common/autotest_common.sh source $rootdir/test/nvmf/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. +nvmftestinit $1 +iscsitestinit $1 $2 + RDMA_IP_LIST=$(get_available_rdma_ips) NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1) if [ -z $NVMF_FIRST_TARGET_IP ]; then @@ -33,7 +38,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; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT + trap "killprocess $iscsipid; killprocess $nvmfpid; iscsitestfini $1 $2; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $iscsipid "$iscsi_rpc_addr" $rpc_py -s "$iscsi_rpc_addr" set_iscsi_options -o 30 -a 16 $rpc_py -s "$iscsi_rpc_addr" start_subsystem_init @@ -66,7 +71,7 @@ NVMF_APP="$rootdir/app/nvmf_tgt/nvmf_tgt" $NVMF_APP -m 0x2 -p 1 -s 512 --wait-for-rpc & nvmfpid=$! echo "NVMf target launched. pid: $nvmfpid" -trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT +trap "killprocess $nvmfpid; iscsitestfini $1 $2; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid $rpc_py start_subsystem_init $rpc_py nvmf_create_transport -t RDMA -u 8192 -p 4 @@ -84,7 +89,7 @@ timing_enter start_iscsi_tgt run_nvme_remote "local" trap "iscsicleanup; killprocess $iscsipid; killprocess $nvmfpid; \ - rm -f ./local-job0-0-verify.state; exit 1" SIGINT SIGTERM EXIT + rm -f ./local-job0-0-verify.state; iscsitestfini $1 $2; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT sleep 1 echo "Running FIO" @@ -108,4 +113,6 @@ $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1 killprocess $nvmfpid report_test_completion "iscsi_nvme_remote" +iscsitestfini $1 $2 +nvmftestfini $1 timing_exit nvme_remote diff --git a/test/iscsi_tgt/qos/qos.sh b/test/iscsi_tgt/qos/qos.sh index d6c20e207..878f7f9fd 100755 --- a/test/iscsi_tgt/qos/qos.sh +++ b/test/iscsi_tgt/qos/qos.sh @@ -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 check_qos_works_well() { local enable_limit=$1 local qos_limit=$2 @@ -80,7 +84,7 @@ timing_enter start_iscsi_tgt $ISCSI_APP & 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 echo "iscsi_tgt is listening. Running tests..." @@ -99,7 +103,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; exit 1" SIGINT SIGTERM EXIT +trap "iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT # Check whether to enable the QoS testing. check_qos_works_well false $IOPS_LIMIT Malloc0 true @@ -140,4 +144,5 @@ rm -f ./local-job0-0-verify.state trap - SIGINT SIGTERM EXIT killprocess $pid +iscsitestfini $1 $2 timing_exit qos diff --git a/test/iscsi_tgt/rbd/rbd.sh b/test/iscsi_tgt/rbd/rbd.sh index d241f25f5..83ecc3c62 100755 --- a/test/iscsi_tgt/rbd/rbd.sh +++ b/test/iscsi_tgt/rbd/rbd.sh @@ -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 + if ! hash ceph; then echo "Ceph not detected on this system; skipping RBD tests" exit 0 @@ -25,7 +29,7 @@ timing_enter start_iscsi_tgt $ISCSI_APP -m $ISCSI_TEST_CORE_MASK --wait-for-rpc & pid=$! -trap "killprocess $pid; rbd_cleanup; exit 1" SIGINT SIGTERM EXIT +trap "killprocess $pid; rbd_cleanup; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT waitforlisten $pid $rpc_py set_iscsi_options -o 30 -a 16 @@ -63,5 +67,6 @@ $rpc_py delete_rbd_bdev $rbd_bdev killprocess $pid rbd_cleanup +iscsitestfini $1 $2 report_test_completion "iscsi_rbd" timing_exit rbd diff --git a/test/iscsi_tgt/reset/reset.sh b/test/iscsi_tgt/reset/reset.sh index 43b8d7345..3a6af6a8e 100755 --- a/test/iscsi_tgt/reset/reset.sh +++ b/test/iscsi_tgt/reset/reset.sh @@ -7,6 +7,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 reset MALLOC_BDEV_SIZE=64 @@ -54,7 +58,7 @@ $fio_py iscsi 512 1 read 60 1 & fiopid=$! echo "FIO pid: $fiopid" -trap "iscsicleanup; killprocess $pid; killprocess $fiopid; exit 1" SIGINT SIGTERM EXIT +trap "iscsicleanup; killprocess $pid; killprocess $fiopid; iscsitestfini $1 $2; 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 +78,5 @@ trap - SIGINT SIGTERM EXIT iscsicleanup killprocess $pid +iscsitestfini $1 $2 timing_exit reset diff --git a/test/iscsi_tgt/sock/sock.sh b/test/iscsi_tgt/sock/sock.sh index 990f91701..a8940cd07 100755 --- a/test/iscsi_tgt/sock/sock.sh +++ b/test/iscsi_tgt/sock/sock.sh @@ -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 + HELLO_SOCK_APP="$TARGET_NS_CMD $rootdir/examples/sock/hello_world/hello_sock" SOCAT_APP="socat" @@ -16,7 +20,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;exit 1" SIGINT SIGTERM EXIT +trap "killprocess $server_pid;iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT waitforlisten $server_pid $INITIATOR_IP:$ISCSI_PORT @@ -43,7 +47,7 @@ timing_enter sock_server # start echo server using hello_sock echo server $HELLO_SOCK_APP -H $TARGET_IP -P $ISCSI_PORT -S & server_pid=$! -trap "killprocess $server_pid;exit 1" SIGINT SIGTERM EXIT +trap "killprocess $server_pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT waitforlisten $server_pid # send message to server using socat @@ -58,5 +62,6 @@ trap - SIGINT SIGTERM EXIT killprocess $server_pid +iscsitestfini $1 $2 report_test_completion "sock_server" 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 e7417c276..e2bd1122f 100755 --- a/test/iscsi_tgt/trace_record/trace_record.sh +++ b/test/iscsi_tgt/trace_record/trace_record.sh @@ -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 + TRACE_TMP_FOLDER=./tmp-trace TRACE_RECORD_OUTPUT=${TRACE_TMP_FOLDER}/record.trace TRACE_RECORD_NOTICE_LOG=${TRACE_TMP_FOLDER}/record.notice @@ -40,7 +44,7 @@ $ISCSI_APP -m 0xf --num-trace-entries $NUM_TRACE_ENTRIES --tpoint-group-mask 0xf iscsi_pid=$! echo "Process pid: $iscsi_pid" -trap "killprocess $iscsi_pid; exit 1" SIGINT SIGTERM EXIT +trap "killprocess $iscsi_pid; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT waitforlisten $iscsi_pid @@ -68,7 +72,7 @@ mkdir -p ${TRACE_TMP_FOLDER} record_pid=$! echo "Trace record pid: $record_pid" -trap "iscsicleanup; killprocess $iscsi_pid; killprocess $record_pid; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT +trap "iscsicleanup; killprocess $iscsi_pid; killprocess $record_pid; delete_tmp_files; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT echo "Running FIO" $fio_py iscsi 131072 32 randrw 1 1 @@ -80,7 +84,7 @@ for i in $(seq 0 $CONNECTION_NUMBER); do $rpc_py delete_malloc_bdev Malloc${i} done -trap "delete_tmp_files; exit 1" SIGINT SIGTERM EXIT +trap "delete_tmp_files; iscsitestfini $1 $2; exit 1" SIGINT SIGTERM EXIT killprocess $iscsi_pid killprocess $record_pid @@ -124,4 +128,5 @@ fi done trap - SIGINT SIGTERM EXIT +iscsitestfini $1 $2 timing_exit trace_record