From ac9d99071e4ff2f51aab56a065a1571dfd591140 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Wed, 10 May 2017 14:25:46 -0400 Subject: [PATCH] vhost/test: SIGKILL vhost after unsuccessful SIGINT Added 1 minute timeout for vhost to exit after receiving INT signal. After timeout send KILL signal to vhost app and exit with error. Change-Id: Ib1659660667991b21103b3401bbd780290521433 Signed-off-by: Karol Latecki --- test/vhost/fiotest/common.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/vhost/fiotest/common.sh b/test/vhost/fiotest/common.sh index 62f908d43..4c2fb380e 100644 --- a/test/vhost/fiotest/common.sh +++ b/test/vhost/fiotest/common.sh @@ -167,11 +167,21 @@ function spdk_vhost_kill() echo "INFO: killing vhost (PID $vhost_pid) app" if /bin/kill -INT $vhost_pid >/dev/null; then - echo "INFO: vhost app killed - waiting to exit" - while /bin/kill -0 $vhost_pid; do - echo "." - sleep 1 + echo "INFO: sent SIGINT to vhost app - waiting 60 seconds to exit" + for ((i=0; i<60; i++)); do + if /bin/kill -0 $vhost_pid; then + echo "." + sleep 1 + else + break + fi done + if /bin/kill -0 $vhost_pid; then + echo "ERROR: vhost was NOT killed - sending SIGKILL" + /bin/kill -KILL $vhost_pid + rm $vhost_pid_file + return 1 + fi elif /bin/kill -0 $vhost_pid; then error "vhost NOT killed - you need to kill it manually" return 1