For the read-only write test, call qmp() directly and assert
the expected GenericError, since qmp_qemu_io() assumes success.

Signed-off-by: Marc-André Lureau <[email protected]>
---
 tests/qemu-iotests/165 | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165
index 13b784fcc64d..e1e557424cec 100755
--- a/tests/qemu-iotests/165
+++ b/tests/qemu-iotests/165
@@ -66,7 +66,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
 
     def writeRegions(self, regions):
         for r in regions:
-            self.vm.hmp_qemu_io('drive0',
+            self.vm.qmp_qemu_io('drive0',
                                 'write %d %d' % r)
 
     def qmpAddBitmap(self):
@@ -138,7 +138,10 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
         assert sha256_1 == self.getSha256()
 
         # Check that we are in RO mode and can't modify bitmap.
-        self.writeRegions(regions2)
+        for r in regions2:
+            result = self.vm.qmp('x-qemu-io', device='drive0',
+                                 command='write %d %d' % r)
+            self.assert_qmp(result, 'error/class', 'GenericError')
         assert sha256_1 == self.getSha256()
 
         # Reopen to RW
@@ -162,5 +165,4 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
 if __name__ == '__main__':
     iotests.main(supported_fmts=['qcow2', 'parallels'],
                  supported_protocols=['file'],
-                 unsupported_imgopts=['compat'],
-                 require_hmp=True)
+                 unsupported_imgopts=['compat'])

-- 
2.56.0.rc0.29.g47ce80527c56


Reply via email to