From: Max Reitz Date: Mon, 18 Feb 2019 18:06:46 +0000 (+0100) Subject: iotests: Skip 211 on insufficient memory X-Git-Tag: v4.0.0-rc0~78^2^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a4e88e17966a963ee818daab3d0c9fa6bf73903;p=thirdparty%2Fqemu.git iotests: Skip 211 on insufficient memory VDI keeps the whole bitmap in memory, and the maximum size (which is tested here) is 2 GB. This may not be available on all machines, and it rarely is available when running a 32 bit build. Fix this by making VM.run_job() return the error string if an error occurred, and checking whether that contains "Could not allocate bmap" in 211. If so, the test is skipped. Signed-off-by: Max Reitz Message-id: 20190218180646.30282-1-mreitz@redhat.com Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Max Reitz --- diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211 index 5d285450b59..6afc894f769 100755 --- a/tests/qemu-iotests/211 +++ b/tests/qemu-iotests/211 @@ -32,7 +32,9 @@ def blockdev_create(vm, options): if 'return' in result: assert result['return'] == {} - vm.run_job('job0') + error = vm.run_job('job0') + if error and 'Could not allocate bmap' in error: + iotests.notrun('Insufficient memory') iotests.log("") with iotests.FilePath('t.vdi') as disk_path, \ diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 387e026556b..4910fb20051 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -532,7 +532,9 @@ class VM(qtest.QEMUQtestMachine): log(result, filters, indent=indent) return result + # Returns None on success, and an error string on failure def run_job(self, job, auto_finalize=True, auto_dismiss=False): + error = None while True: for ev in self.get_qmp_events_filtered(wait=True): if ev['event'] == 'JOB_STATUS_CHANGE': @@ -541,13 +543,14 @@ class VM(qtest.QEMUQtestMachine): result = self.qmp('query-jobs') for j in result['return']: if j['id'] == job: + error = j['error'] log('Job failed: %s' % (j['error'])) elif status == 'pending' and not auto_finalize: self.qmp_log('job-finalize', id=job) elif status == 'concluded' and not auto_dismiss: self.qmp_log('job-dismiss', id=job) elif status == 'null': - return + return error else: iotests.log(ev)