test/blockdev: add trap for bdev_svc process

There was a gap where nbd tests could fail, but without
trap set the app would still be present.

When here removed trap from end of the script since,
no part of the script set it up.

Change-Id: I0c435c7cd603410c2cd7a034bf955ab424e413f0
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457615
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2019-06-11 09:07:55 -04:00 committed by Darek Stojaczyk
parent e3d21c7778
commit 1599301b7b

View File

@ -37,6 +37,7 @@ function nbd_function_test() {
modprobe nbd modprobe nbd
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 -c ${conf} & $rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -i 0 -c ${conf} &
nbd_pid=$! nbd_pid=$!
trap "killprocess $nbd_pid; exit 1" SIGINT SIGTERM EXIT
echo "Process nbd pid: $nbd_pid" echo "Process nbd pid: $nbd_pid"
waitforlisten $nbd_pid $rpc_server waitforlisten $nbd_pid $rpc_server
@ -46,6 +47,7 @@ function nbd_function_test() {
$rpc_py -s $rpc_server delete_passthru_bdev TestPT $rpc_py -s $rpc_server delete_passthru_bdev TestPT
killprocess $nbd_pid killprocess $nbd_pid
trap - SIGINT SIGTERM EXIT
fi fi
return 0 return 0
@ -174,7 +176,6 @@ fi
rm -f /tmp/aiofile rm -f /tmp/aiofile
rm -f /tmp/spdk-pmem-pool rm -f /tmp/spdk-pmem-pool
rm -f $testdir/bdev.conf rm -f $testdir/bdev.conf
trap - SIGINT SIGTERM EXIT
rbd_cleanup rbd_cleanup
report_test_completion "bdev" report_test_completion "bdev"
timing_exit bdev timing_exit bdev