Spdk/test/nvmf/target/nvmf_example.sh
JinYu c871ee40e6 nvmf_example: add the signal handler
Add the same handler for SIGINT and SIGTERM so that
the working thread can exit.

Change-Id: If1ce617ddd778e92bed6f95089c48caf841e256f
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468661
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:05 +00:00

38 lines
942 B
Bash
Executable File

#!/usr/bin/env bash
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
rpc_py="$rootdir/scripts/rpc.py"
function build_nvmf_example_args()
{
if [ $SPDK_RUN_NON_ROOT -eq 1 ]; then
echo "sudo -u $(logname) ./examples/nvmf/nvmf/nvmf -i $NVMF_APP_SHM_ID"
else
echo "./examples/nvmf/nvmf/nvmf -i $NVMF_APP_SHM_ID"
fi
}
NVMF_EXAMPLE="$(build_nvmf_example_args)"
function nvmfexamplestart()
{
timing_enter start_nvmf_example
$NVMF_EXAMPLE $1 &
nvmfpid=$!
trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
waitforfile /var/tmp/spdk.sock
timing_exit start_nvmf_example
}
timing_enter nvmf_example_test
nvmftestinit
nvmfexamplestart "-m 0xF"
trap - SIGINT SIGTERM EXIT
nvmftestfini
timing_exit nvmf_example_test