2016-08-03 21:37:16 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2017-04-04 23:20:16 +00:00
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2018-02-27 22:14:08 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2017-05-24 23:29:24 +00:00
|
|
|
source $rootdir/test/iscsi_tgt/common.sh
|
2016-08-03 21:37:16 +00:00
|
|
|
|
2020-08-11 10:36:11 +00:00
|
|
|
iscsitestinit
|
2016-08-03 21:37:16 +00:00
|
|
|
|
2018-04-23 07:04:15 +00:00
|
|
|
MALLOC_BDEV_SIZE=64
|
2016-08-03 21:37:16 +00:00
|
|
|
|
|
|
|
rpc_py=$rootdir/scripts/rpc.py
|
2018-09-11 13:26:14 +00:00
|
|
|
rpc_config_py="$testdir/rpc_config.py"
|
2016-08-03 21:37:16 +00:00
|
|
|
|
2017-05-25 20:06:51 +00:00
|
|
|
timing_enter start_iscsi_tgt
|
2016-08-03 21:37:16 +00:00
|
|
|
|
2020-02-20 10:24:53 +00:00
|
|
|
"${ISCSI_APP[@]}" --wait-for-rpc &
|
2016-08-03 21:37:16 +00:00
|
|
|
pid=$!
|
|
|
|
echo "Process pid: $pid"
|
|
|
|
|
2019-08-09 08:46:01 +00:00
|
|
|
trap 'killprocess $pid; exit 1' SIGINT SIGTERM EXIT
|
2016-08-03 21:37:16 +00:00
|
|
|
|
2017-11-09 23:33:29 +00:00
|
|
|
waitforlisten $pid
|
2019-09-11 13:35:41 +00:00
|
|
|
$rpc_py framework_wait_init &
|
2019-06-04 07:03:58 +00:00
|
|
|
rpc_wait_pid=$!
|
2019-09-11 11:15:34 +00:00
|
|
|
$rpc_py iscsi_set_options -o 30 -a 16
|
2019-06-04 07:03:58 +00:00
|
|
|
|
2019-09-11 13:35:41 +00:00
|
|
|
# RPC framework_wait_init should be blocked, so its process must be existed
|
2019-06-04 07:03:58 +00:00
|
|
|
ps $rpc_wait_pid
|
|
|
|
|
2019-09-11 13:30:14 +00:00
|
|
|
$rpc_py framework_start_init
|
2016-08-03 21:37:16 +00:00
|
|
|
echo "iscsi_tgt is listening. Running tests..."
|
|
|
|
|
2019-09-11 13:35:41 +00:00
|
|
|
# RPC framework_wait_init should be already returned, so its process must be non-existed
|
2019-06-04 07:03:58 +00:00
|
|
|
! ps $rpc_wait_pid
|
|
|
|
|
2019-09-11 13:35:41 +00:00
|
|
|
# RPC framework_wait_init will directly returned after subsystem initialized.
|
|
|
|
$rpc_py framework_wait_init &
|
2019-06-04 07:03:58 +00:00
|
|
|
rpc_wait_pid=$!
|
|
|
|
sleep 1
|
|
|
|
! ps $rpc_wait_pid
|
|
|
|
|
2017-05-25 20:06:51 +00:00
|
|
|
timing_exit start_iscsi_tgt
|
|
|
|
|
2020-08-11 10:42:06 +00:00
|
|
|
$rpc_config_py $rpc_py $TARGET_IP $INITIATOR_IP $ISCSI_PORT $NETMASK $TARGET_NAMESPACE
|
2016-08-03 21:37:16 +00:00
|
|
|
|
2019-09-11 09:29:55 +00:00
|
|
|
$rpc_py bdev_get_bdevs
|
2016-11-18 17:22:58 +00:00
|
|
|
|
2016-08-03 21:37:16 +00:00
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
iscsicleanup
|
|
|
|
killprocess $pid
|
2019-06-13 14:26:18 +00:00
|
|
|
|
2020-08-11 10:36:11 +00:00
|
|
|
iscsitestfini
|