No need to wait until the VM is shut down to verify the output.
Signed-off-by: Marc-André Lureau <[email protected]>
---
tests/qemu-iotests/245 | 28 +++-------------------------
1 file changed, 3 insertions(+), 25 deletions(-)
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
index 2f354d1d9205..3f4a87d2cd8a 100755
--- a/tests/qemu-iotests/245
+++ b/tests/qemu-iotests/245
@@ -58,34 +58,13 @@ class TestBlockdevReopen(iotests.QMPTestCase):
def tearDown(self):
self.vm.shutdown()
- self.check_qemu_io_errors()
os.remove(hd_path[0])
os.remove(hd_path[1])
os.remove(hd_path[2])
- # The output of qemu-io is not returned by vm.hmp_qemu_io() but
- # it's stored in the log and can only be read when the VM has been
- # shut down. This function runs qemu-io and keeps track of the
- # number of times it's been called.
def run_qemu_io(self, img, cmd):
- result = self.vm.hmp_qemu_io(img, cmd)
- self.assert_qmp(result, 'return', '')
- self.total_io_cmds += 1
-
- # Once the VM is shut down we can parse the log and see if qemu-io
- # ran without errors.
- def check_qemu_io_errors(self):
- self.assertFalse(self.vm.is_running())
- found = 0
- log = self.vm.get_log()
- for line in log.split("\n"):
- if line.startswith("Pattern verification failed"):
- raise Exception("%s (command #%d)" % (line, found))
- if re.match("(read|wrote) .*/.* bytes at offset", line):
- found += 1
- self.assertEqual(found, self.total_io_cmds,
- "Expected output of %d qemu-io commands, found %d" %
- (found, self.total_io_cmds))
+ result = self.vm.qmp('x-qemu-io', device=img, command=cmd)
+ self.assert_qmp_absent(result, 'error')
# Run blockdev-reopen on a list of block devices
def reopenMultiple(self, opts, errmsg = None):
@@ -1160,5 +1139,4 @@ class TestBlockdevReopen(iotests.QMPTestCase):
if __name__ == '__main__':
iotests.activate_logging()
iotests.main(supported_fmts=["qcow2"],
- supported_protocols=["file"],
- require_hmp=True)
+ supported_protocols=["file"])
--
2.56.0.rc0.29.g47ce80527c56