diff --git a/autotest.sh b/autotest.sh index ab59e8012..8c178b6e6 100755 --- a/autotest.sh +++ b/autotest.sh @@ -120,7 +120,7 @@ fi timing_exit lib if [ $SPDK_TEST_ISCSI -eq 1 ]; then - run_test ./test/iscsi_tgt/iscsi_tgt.sh + run_test ./test/iscsi_tgt/iscsi_tgt.sh posix fi if [ $SPDK_TEST_BLOBFS -eq 1 ]; then diff --git a/test/iscsi_tgt/common.sh b/test/iscsi_tgt/common.sh index 2026d47fb..1928449b5 100644 --- a/test/iscsi_tgt/common.sh +++ b/test/iscsi_tgt/common.sh @@ -16,10 +16,11 @@ ISCSI_APP="$TARGET_NS_CMD ./app/iscsi_tgt/iscsi_tgt -i 0" ISCSI_TEST_CORE_MASK=0xFF function create_veth_interfaces() { + # $1 = test type (posix/vpp) ip netns del $TARGET_NAMESPACE || true ip link delete $INITIATOR_INTERFACE || true - trap "cleanup_veth_interfaces; exit 1" SIGINT SIGTERM EXIT + trap "cleanup_veth_interfaces $1; exit 1" SIGINT SIGTERM EXIT # Create veth (Virtual ethernet) interface pair ip link add $INITIATOR_INTERFACE type veth peer name $TARGET_INTERFACE @@ -40,6 +41,8 @@ function create_veth_interfaces() { } function cleanup_veth_interfaces() { + # $1 = test type (posix/vpp) + # Cleanup veth interfaces and network namespace # Note: removing one veth, removes the pair ip link delete $INITIATOR_INTERFACE diff --git a/test/iscsi_tgt/iscsi_tgt.sh b/test/iscsi_tgt/iscsi_tgt.sh index b775da8ae..a8c9ce49d 100755 --- a/test/iscsi_tgt/iscsi_tgt.sh +++ b/test/iscsi_tgt/iscsi_tgt.sh @@ -11,8 +11,16 @@ source $rootdir/test/iscsi_tgt/common.sh timing_enter iscsi_tgt +# $1 = test type (posix/vpp) +if [ "$1" == "posix" ] || [ "$1" == "vpp" ]; then + TEST_TYPE=$1 +else + echo "No iSCSI test type specified" + exit 1 +fi + # Network configuration -create_veth_interfaces +create_veth_interfaces $TEST_TYPE # ISCSI_TEST_CORE_MASK is the biggest core mask specified by # any of the iscsi_tgt tests. Using this mask for the stub @@ -22,12 +30,12 @@ create_veth_interfaces # core 0) so there is no impact to the iscsi_tgt tests by # specifying the bigger core mask. start_stub "-s 2048 -i 0 -m $ISCSI_TEST_CORE_MASK" -trap "kill_stub; cleanup_veth_interfaces; exit 1" SIGINT SIGTERM EXIT +trap "kill_stub; cleanup_veth_interfaces $TEST_TYPE; exit 1" SIGINT SIGTERM EXIT run_test ./test/iscsi_tgt/calsoft/calsoft.sh run_test ./test/iscsi_tgt/filesystem/filesystem.sh run_test ./test/iscsi_tgt/reset/reset.sh -run_test ./test/iscsi_tgt/rpc_config/rpc_config.sh +run_test ./test/iscsi_tgt/rpc_config/rpc_config.sh $TEST_TYPE run_test ./test/iscsi_tgt/lvol/iscsi_lvol.sh run_test ./test/iscsi_tgt/fio/fio.sh run_test ./test/iscsi_tgt/qos/qos.sh @@ -44,7 +52,7 @@ if [ $SPDK_TEST_RBD -eq 1 ]; then run_test ./test/iscsi_tgt/rbd/rbd.sh fi -trap "cleanup_veth_interfaces; exit 1" SIGINT SIGTERM EXIT +trap "cleanup_veth_interfaces $TEST_TYPE; exit 1" SIGINT SIGTERM EXIT kill_stub if [ $SPDK_TEST_NVMF -eq 1 ]; then @@ -62,6 +70,6 @@ if [ $SPDK_TEST_ISCSI_INITIATOR -eq 1 ]; then run_test ./test/iscsi_tgt/initiator/initiator.sh fi -cleanup_veth_interfaces +cleanup_veth_interfaces $TEST_TYPE trap - SIGINT SIGTERM EXIT timing_exit iscsi_tgt diff --git a/test/iscsi_tgt/rpc_config/rpc_config.py b/test/iscsi_tgt/rpc_config/rpc_config.py index dddd1e658..0af4ab39f 100755 --- a/test/iscsi_tgt/rpc_config/rpc_config.py +++ b/test/iscsi_tgt/rpc_config/rpc_config.py @@ -10,12 +10,13 @@ import json import random from subprocess import check_call, call, check_output, Popen, PIPE, CalledProcessError -if (len(sys.argv) == 7): +if (len(sys.argv) == 8): target_ip = sys.argv[2] initiator_ip = sys.argv[3] port = sys.argv[4] netmask = sys.argv[5] namespace = sys.argv[6] + test_type = sys.argv[7] ns_cmd = 'ip netns exec ' + namespace other_ip = '127.0.0.6' diff --git a/test/iscsi_tgt/rpc_config/rpc_config.sh b/test/iscsi_tgt/rpc_config/rpc_config.sh index 0e7048c14..0013cb2b2 100755 --- a/test/iscsi_tgt/rpc_config/rpc_config.sh +++ b/test/iscsi_tgt/rpc_config/rpc_config.sh @@ -7,8 +7,15 @@ source $rootdir/test/iscsi_tgt/common.sh timing_enter rpc_config -MALLOC_BDEV_SIZE=64 +# $1 = test type (posix/vpp) +if [ "$1" == "posix" ] || [ "$1" == "vpp" ]; then + TEST_TYPE=$1 +else + echo "No iSCSI test type specified" + exit 1 +fi +MALLOC_BDEV_SIZE=64 rpc_py=$rootdir/scripts/rpc.py rpc_config_py="python $testdir/rpc_config.py" @@ -26,7 +33,7 @@ echo "iscsi_tgt is listening. Running tests..." timing_exit start_iscsi_tgt -$rpc_config_py $rpc_py $TARGET_IP $INITIATOR_IP $ISCSI_PORT $NETMASK $TARGET_NAMESPACE +$rpc_config_py $rpc_py $TARGET_IP $INITIATOR_IP $ISCSI_PORT $NETMASK $TARGET_NAMESPACE $TEST_TYPE $rpc_py get_bdevs