test/iscsi: allow choosing net framework for iSCSI tests

Type of net framework is now passed throughout the iSCSI tests.

This is in preparation for running VPP tests alongside the ones
on posix.

Change-Id: Ifb25a9e4b04512de882883278b8bb465de579828
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/408879
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2018-04-23 03:04:15 -04:00 committed by Jim Harris
parent 7a02938bac
commit 19dd8ea576
5 changed files with 29 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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