From: Max Reitz Date: Tue, 2 Dec 2014 17:32:48 +0000 (+0100) Subject: iotests: Only kill NBD server if it runs X-Git-Tag: qemu-xen-4.6.0-rc1~34^2~47 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0a0a9843524a80a632e827e5c2cfb7c6a496f8ba;p=qemu-upstream-unstable.git iotests: Only kill NBD server if it runs There may be NBD tests which do not create a sample image and simply test whether wrong usage of the protocol is rejected as expected. In this case, there will be no NBD server and trying to kill it during clean-up will fail. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf (cherry picked from commit f798068c565918ead63218d083ff814b7635be72) Signed-off-by: Michael Roth --- diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 9c49deb3d..f2554ec0a 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -175,7 +175,9 @@ _cleanup_test_img() case "$IMGPROTO" in nbd) - kill $QEMU_NBD_PID + if [ -n "$QEMU_NBD_PID" ]; then + kill $QEMU_NBD_PID + fi rm -f "$TEST_IMG_FILE" ;; file)