1#!/usr/bin/env bash 2 3testdir=$(readlink -f $(dirname $0)) 4rootdir=$(readlink -f $testdir/../../..) 5source $rootdir/test/common/autotest_common.sh 6source $rootdir/test/iscsi_tgt/common.sh 7 8iscsitestinit 9 10MALLOC_BDEV_SIZE=64 11 12rpc_py=$rootdir/scripts/rpc.py 13rpc_config_py="$testdir/rpc_config.py" 14 15timing_enter start_iscsi_tgt 16 17"${ISCSI_APP[@]}" --wait-for-rpc & 18pid=$! 19echo "Process pid: $pid" 20 21trap 'killprocess $pid; exit 1' SIGINT SIGTERM EXIT 22 23waitforlisten $pid 24$rpc_py framework_wait_init & 25rpc_wait_pid=$! 26$rpc_py iscsi_set_options -o 30 -a 16 27 28# RPC framework_wait_init should be blocked, so its process must be existed 29ps $rpc_wait_pid 30 31$rpc_py framework_start_init 32sleep 1 33echo "iscsi_tgt is listening. Running tests..." 34 35# RPC framework_wait_init should be already returned, so its process must be non-existed 36NOT ps $rpc_wait_pid 37 38# RPC framework_wait_init will directly returned after subsystem initialized. 39$rpc_py framework_wait_init & 40rpc_wait_pid=$! 41sleep 1 42NOT ps $rpc_wait_pid 43 44timing_exit start_iscsi_tgt 45 46$rpc_config_py $rpc_py $TARGET_IP $INITIATOR_IP $ISCSI_PORT $NETMASK $TARGET_NAMESPACE 47 48$rpc_py bdev_get_bdevs 49 50trap - SIGINT SIGTERM EXIT 51 52iscsicleanup 53killprocess $pid 54 55iscsitestfini 56