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 <karolx.latecki@intel.com>
This commit is contained in:
Karol Latecki 2017-05-10 14:25:46 -04:00 committed by Piotr Pelplinski
parent d8369fee70
commit ac9d99071e

View File

@ -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