test/vhost: Don't remove QEMU's pidfile when terminating the process
QEMU is fully capable of unlinking its own pidfile so it may happen that after sending a signal to terminate it, the file is already gone when we attempt to rm it - in such a case, rm fails leading to overall test failure. Avoid that by allowing QEMU to do its job. For cases where QEMU might have potentially failed (e.g. due to a crash) we leave the rm in with an extra -f on its cmdline. Signed-off-by: Michal Berger <michal.berger@intel.com> Change-Id: Ia8d5c73dd76225583a63c1f622835e22ce32e66c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16040 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
5871a46e99
commit
1efd574527
@ -218,7 +218,6 @@ function vhost_kill() {
|
|||||||
if kill -0 $vhost_pid; then
|
if kill -0 $vhost_pid; then
|
||||||
error "ERROR: vhost was NOT killed - sending SIGABRT"
|
error "ERROR: vhost was NOT killed - sending SIGABRT"
|
||||||
kill -ABRT $vhost_pid
|
kill -ABRT $vhost_pid
|
||||||
rm $vhost_pid_file
|
|
||||||
rc=1
|
rc=1
|
||||||
else
|
else
|
||||||
while kill -0 $vhost_pid; do
|
while kill -0 $vhost_pid; do
|
||||||
@ -233,9 +232,6 @@ function vhost_kill() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
timing_exit vhost_kill
|
timing_exit vhost_kill
|
||||||
if [[ $rc == 0 ]]; then
|
|
||||||
rm $vhost_pid_file
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf "$vhost_dir"
|
rm -rf "$vhost_dir"
|
||||||
|
|
||||||
@ -366,7 +362,7 @@ function vm_is_running() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# not running - remove pid file
|
# not running - remove pid file
|
||||||
rm $vm_dir/qemu.pid
|
rm -f $vm_dir/qemu.pid
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -434,7 +430,6 @@ function vm_kill() {
|
|||||||
# First kill should fail, second one must fail
|
# First kill should fail, second one must fail
|
||||||
if /bin/kill $vm_pid; then
|
if /bin/kill $vm_pid; then
|
||||||
notice "process $vm_pid killed"
|
notice "process $vm_pid killed"
|
||||||
rm $vm_dir/qemu.pid
|
|
||||||
rm -rf $vm_dir
|
rm -rf $vm_dir
|
||||||
elif vm_is_running $1; then
|
elif vm_is_running $1; then
|
||||||
error "Process $vm_pid NOT killed"
|
error "Process $vm_pid NOT killed"
|
||||||
|
Loading…
Reference in New Issue
Block a user