summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests/iotests.py
diff options
context:
space:
mode:
authorPeter Maydell2018-06-11 16:31:20 +0200
committerPeter Maydell2018-06-11 16:31:20 +0200
commit2afc4e3df80d947dd1bd42ce80278f591b35c74a (patch)
tree42e78514e9d7531449c612cfa130cd8e2ae97260 /tests/qemu-iotests/iotests.py
parentMerge remote-tracking branch 'remotes/vivier/tags/m68k-for-3.0-pull-request' ... (diff)
parentiotests: Add case for a corrupted inactive image (diff)
downloadqemu-2afc4e3df80d947dd1bd42ce80278f591b35c74a.tar.gz
qemu-2afc4e3df80d947dd1bd42ce80278f591b35c74a.tar.xz
qemu-2afc4e3df80d947dd1bd42ce80278f591b35c74a.zip
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2018-06-11' into staging
Block patches: - Various bug fixes - Removal of qemu-img convert's deprecated -s option - qemu-io now exits with an error when a command failed # gpg: Signature made Mon 11 Jun 2018 15:23:42 BST # gpg: using RSA key F407DB0061D5CF40 # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40 * remotes/maxreitz/tags/pull-block-2018-06-11: (29 commits) iotests: Add case for a corrupted inactive image qcow2: Do not mark inactive images corrupt block: Make bdrv_is_writable() public throttle: Fix crash on reopen block/qcow2-bitmap: fix free_bitmap_clusters qemu-img: Remove deprecated -s snapshot_id_or_name option iotests: Fix 219's timing iotests: improve pause_job iotests: Test post-backing convert target behavior qemu-img: Special post-backing convert handling iotests: Add test for rebasing with relative paths qemu-img: Resolve relative backing paths in rebase iotests: Let 216 make use of qemu-io's exit code iotests.py: Add qemu_io_silent qemu-io: Exit with error when a command failed qemu-io: Let command functions return error code qemu-io: Drop command functions' return values iotests: Repairing error during snapshot deletion qcow2: Repair OFLAG_COPIED when fixing leaks iotests: Rework 113 ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/qemu-iotests/iotests.py')
-rw-r--r--tests/qemu-iotests/iotests.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index fdbdd8b300..2f22fab2a7 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -133,6 +133,15 @@ def qemu_io(*args):
sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitcode, ' '.join(args)))
return subp.communicate()[0]
+def qemu_io_silent(*args):
+ '''Run qemu-io and return the exit code, suppressing stdout'''
+ args = qemu_io_args + list(args)
+ exitcode = subprocess.call(args, stdout=open('/dev/null', 'w'))
+ if exitcode < 0:
+ sys.stderr.write('qemu-io received signal %i: %s\n' %
+ (-exitcode, ' '.join(args)))
+ return exitcode
+
class QemuIoInteractive:
def __init__(self, *args):
@@ -581,9 +590,14 @@ class QMPTestCase(unittest.TestCase):
with Timeout(1, "Timeout waiting for job to pause"):
while True:
result = self.vm.qmp('query-block-jobs')
+ found = False
for job in result['return']:
- if job['device'] == job_id and job['paused'] == True and job['busy'] == False:
- return job
+ if job['device'] == job_id:
+ found = True
+ if job['paused'] == True and job['busy'] == False:
+ return job
+ break
+ assert found
def pause_job(self, job_id='job0', wait=True):
result = self.vm.qmp('block-job-pause', device=job_id)