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/spdkcli/common.sh 7 8function err_cleanup() { 9 if [ -n "$socat_pid" ]; then 10 killprocess $socat_pid || true 11 fi 12 killprocess $spdk_tgt_pid 13} 14 15IP_ADDRESS="127.0.0.1" 16PORT="9998" 17 18trap 'err_cleanup; exit 1' SIGINT SIGTERM EXIT 19 20timing_enter run_spdk_tgt_tcp 21$SPDK_BIN_DIR/spdk_tgt -m 0x3 -p 0 -s 2048 & 22spdk_tgt_pid=$! 23 24waitforlisten $spdk_tgt_pid 25 26# socat will terminate automatically after the connection is closed 27socat TCP-LISTEN:$PORT UNIX-CONNECT:$DEFAULT_RPC_ADDR & 28socat_pid=$! 29 30$rootdir/scripts/rpc.py -r 100 -t 2 -s $IP_ADDRESS -p $PORT rpc_get_methods 31 32timing_exit run_spdk_tgt_tcp 33 34trap - SIGINT SIGTERM EXIT 35killprocess $spdk_tgt_pid 36