diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/qemu-iotests/147 | 4 | ||||
-rw-r--r-- | tests/qemu-iotests/iotests.py | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/tests/qemu-iotests/147 b/tests/qemu-iotests/147 index 82513279b0..2d84fddb01 100755 --- a/tests/qemu-iotests/147 +++ b/tests/qemu-iotests/147 @@ -24,7 +24,7 @@ import socket import stat import time import iotests -from iotests import cachemode, imgfmt, qemu_img, qemu_nbd, qemu_nbd_pipe +from iotests import cachemode, imgfmt, qemu_img, qemu_nbd, qemu_nbd_early_pipe NBD_PORT_START = 32768 NBD_PORT_END = NBD_PORT_START + 1024 @@ -93,7 +93,7 @@ class QemuNBD(NBDBlockdevAddBase): pass def _try_server_up(self, *args): - status, msg = qemu_nbd_pipe('-f', imgfmt, test_img, *args) + status, msg = qemu_nbd_early_pipe('-f', imgfmt, test_img, *args) if status == 0: return True if 'Address already in use' in msg: diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 6bcddd8870..f11482f3dc 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -209,9 +209,9 @@ def qemu_nbd(*args): '''Run qemu-nbd in daemon mode and return the parent's exit code''' return subprocess.call(qemu_nbd_args + ['--fork'] + list(args)) -def qemu_nbd_pipe(*args): +def qemu_nbd_early_pipe(*args): '''Run qemu-nbd in daemon mode and return both the parent's exit code - and its output''' + and its output in case of an error''' subp = subprocess.Popen(qemu_nbd_args + ['--fork'] + list(args), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -221,7 +221,10 @@ def qemu_nbd_pipe(*args): sys.stderr.write('qemu-nbd received signal %i: %s\n' % (-exitcode, ' '.join(qemu_nbd_args + ['--fork'] + list(args)))) - return exitcode, subp.communicate()[0] + if exitcode == 0: + return exitcode, '' + else: + return exitcode, subp.communicate()[0] def compare_images(img1, img2, fmt1=imgfmt, fmt2=imgfmt): '''Return True if two image files are identical''' |