test/iscsi_tgt: add a common bash script

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I76b442115caa5e9320ded671be6bc54a6a98a2b4

Reviewed-on: https://review.gerrithub.io/362451
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2017-05-24 16:29:24 -07:00 committed by Ben Walker
parent 41d477cfa3
commit b20d0296f8
11 changed files with 33 additions and 104 deletions

View File

@ -2,21 +2,13 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
if [ ! -d /usr/local/calsoft ]; then
echo "skipping calsoft tests"
exit 0
fi
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z "$INITIATOR_IP" ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
timing_enter calsoft
# iSCSI target configuration
@ -36,7 +28,7 @@ mkdir -p /usr/local/etc
cp $testdir/its.conf /usr/local/etc/
cp $testdir/auth.conf /usr/local/etc/
./app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
$ISCSI_APP -c $testdir/iscsi.conf &
pid=$!
echo "Process pid: $pid"

13
test/iscsi_tgt/common.sh Normal file
View File

@ -0,0 +1,13 @@
if [ -z $TARGET_IP ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z $INITIATOR_IP ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
if [ -z "$ISCSI_APP" ]; then
ISCSI_APP=./app/iscsi_tgt/iscsi_tgt
fi

View File

@ -3,25 +3,12 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
if [ ! -z $1 ]; then
DPDK_DIR=$(readlink -f $1)
fi
if [ -z "$TARGET_IP" ]; then
TARGET_IP=127.0.0.1
echo "TARGET_IP not defined - using 127.0.0.1"
fi
if [ -z "$INITIATOR_IP" ]; then
INITIATOR_IP=127.0.0.1
echo "INITIATOR_IP not defined - using 127.0.0.1"
fi
if [ -z "$ISCSI_APP" ]; then
ISCSI_APP=./app/iscsi_tgt/iscsi_tgt
fi
timing_enter ext4test
cp $testdir/iscsi.conf.in $testdir/iscsi.conf

View File

@ -3,16 +3,7 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z "$INITIATOR_IP" ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
source $rootdir/test/iscsi_tgt/common.sh
timing_enter filesystem
@ -27,7 +18,7 @@ MALLOC_BLOCK_SIZE=512
rpc_py="python $rootdir/scripts/rpc.py"
./app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
$ISCSI_APP -c $testdir/iscsi.conf &
pid=$!
echo "Process pid: $pid"

View File

@ -3,6 +3,7 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
function running_config() {
# generate a config file from the running iscsi_tgt
@ -15,7 +16,7 @@ function running_config() {
# config file matched the running configuration
killprocess $pid
trap "iscsicleanup; exit 1" SIGINT SIGTERM EXIT
./app/iscsi_tgt/iscsi_tgt -c /tmp/iscsi.conf &
$ISCSI_APP -c /tmp/iscsi.conf &
pid=$!
echo "Process pid: $pid"
trap "iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
@ -53,7 +54,7 @@ MALLOC_BLOCK_SIZE=4096
rpc_py="python $rootdir/scripts/rpc.py"
fio_py="python $rootdir/scripts/fio.py"
./app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
$ISCSI_APP -c $testdir/iscsi.conf &
pid=$!
echo "Process pid: $pid"

View File

@ -3,16 +3,7 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z "$INITIATOR_IP" ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
source $rootdir/test/iscsi_tgt/common.sh
timing_enter idle_migration
@ -22,7 +13,7 @@ RPC_PORT=5260
fio_py="python $rootdir/scripts/fio.py"
./app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
$ISCSI_APP -c $testdir/iscsi.conf &
pid=$!
echo "Process pid: $pid"

View File

@ -3,16 +3,7 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z "$INITIATOR_IP" ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
source $rootdir/test/iscsi_tgt/common.sh
rpc_py="python $rootdir/scripts/rpc.py"
fio_py="python $rootdir/scripts/fio.py"
@ -45,13 +36,12 @@ timing_enter ip_migration
# iSCSI target configuration
echo "Running ip migration tests"
exe=./app/iscsi_tgt/iscsi_tgt
for ((i=0; i<2; i++))
do
cp $testdir/iscsi.conf $testdir/iscsi.conf.$i
port=$(($RPC_PORT + $i))
echo "Listen 127.0.0.1:$port" >> $testdir/iscsi.conf.$i
$exe -c $testdir/iscsi.conf.$i -s 1000 -i $i &
$ISCSI_APP -c $testdir/iscsi.conf.$i -s 1000 -i $i &
pid=$!
echo "Process pid: $pid"

View File

@ -6,16 +6,7 @@ testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
source $rootdir/test/nvmf/common.sh
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z "$INITIATOR_IP" ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
source $rootdir/test/iscsi_tgt/common.sh
if ! rdma_nic_available; then
echo "no NIC for nvmf test"
@ -42,7 +33,7 @@ $rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode1 'transport:R
echo "NVMf subsystem created."
# Start the iSCSI target
$rootdir/app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf -m 0x1 -p 0 -s 512 &
$ISCSI_APP -c $testdir/iscsi.conf -m 0x1 -p 0 -s 512 &
iscsipid=$!
echo "iSCSI target launched. pid: $iscsipid"
trap "killprocess $iscsipid; killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT

View File

@ -3,6 +3,7 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
if [ -z $CEPH_DIR ]; then
echo "Ceph directory not defined; skipping RBD tests"
@ -14,16 +15,6 @@ if [ ! -d $CEPH_DIR ]; then
exit 0
fi
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z "$INITIATOR_IP" ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
timing_enter rbd
# iSCSI target configuration
@ -36,7 +27,7 @@ NETMASK=$INITIATOR_IP/32
rpc_py="python $rootdir/scripts/rpc.py"
fio_py="python $rootdir/scripts/fio.py"
$rootdir/app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
$ISCSI_APP -c $testdir/iscsi.conf &
pid=$!
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT

View File

@ -5,16 +5,7 @@ set -xe
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z "$INITIATOR_IP" ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
source $rootdir/test/iscsi_tgt/common.sh
timing_enter reset
@ -34,7 +25,7 @@ if ! hash sg_reset; then
exit 1
fi
./app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
$ISCSI_APP -c $testdir/iscsi.conf &
pid=$!
echo "Process pid: $pid"

View File

@ -3,16 +3,7 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/scripts/autotest_common.sh
if [ -z "$TARGET_IP" ]; then
echo "TARGET_IP not defined in environment"
exit 1
fi
if [ -z "$INITIATOR_IP" ]; then
echo "INITIATOR_IP not defined in environment"
exit 1
fi
source $rootdir/test/iscsi_tgt/common.sh
timing_enter rpc_config
@ -29,7 +20,7 @@ rpc_py=$rootdir/scripts/rpc.py
rpc_config_py="python $testdir/rpc_config.py"
./app/iscsi_tgt/iscsi_tgt -c $testdir/iscsi.conf &
$ISCSI_APP -c $testdir/iscsi.conf &
pid=$!
echo "Process pid: $pid"