diff mbox series

[34/67] iotests/155: Honor $IMGOPTS

Message ID 20191001194715.2796-35-mreitz@redhat.com
State New
Headers show
Series iotests: Honor $IMGOPTS in Python tests | expand

Commit Message

Max Reitz Oct. 1, 2019, 7:46 p.m. UTC
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/155 | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155
index e19485911c..4efe0e2237 100755
--- a/tests/qemu-iotests/155
+++ b/tests/qemu-iotests/155
@@ -23,7 +23,7 @@ 
 
 import os
 import iotests
-from iotests import qemu_img
+from iotests import create_test_image, remove_test_image
 
 back0_img = os.path.join(iotests.test_dir, 'back0.' + iotests.imgfmt)
 back1_img = os.path.join(iotests.test_dir, 'back1.' + iotests.imgfmt)
@@ -51,10 +51,10 @@  class BaseClass(iotests.QMPTestCase):
     target_real_backing = None
 
     def setUp(self):
-        qemu_img('create', '-f', iotests.imgfmt, back0_img, '1440K')
-        qemu_img('create', '-f', iotests.imgfmt, '-b', back0_img, back1_img)
-        qemu_img('create', '-f', iotests.imgfmt, '-b', back1_img, back2_img)
-        qemu_img('create', '-f', iotests.imgfmt, '-b', back2_img, source_img)
+        create_test_image(back0_img, '1440K')
+        create_test_image(back1_img, backing_file=back0_img)
+        create_test_image(back2_img, backing_file=back1_img)
+        create_test_image(source_img, backing_file=back2_img)
 
         self.vm = iotests.VM()
         # Add the BDS via blockdev-add so it stays around after the mirror block
@@ -71,10 +71,10 @@  class BaseClass(iotests.QMPTestCase):
 
         if self.existing:
             if self.target_backing:
-                qemu_img('create', '-f', iotests.imgfmt,
-                         '-b', self.target_backing, target_img, '1440K')
+                create_test_image(target_img, '1440K', \
+                                  backing_file=self.target_backing)
             else:
-                qemu_img('create', '-f', iotests.imgfmt, target_img, '1440K')
+                create_test_image(target_img, '1440K')
 
             if self.cmd == 'blockdev-mirror':
                 options = { 'node-name': 'target',
@@ -89,14 +89,11 @@  class BaseClass(iotests.QMPTestCase):
 
     def tearDown(self):
         self.vm.shutdown()
-        os.remove(source_img)
-        os.remove(back2_img)
-        os.remove(back1_img)
-        os.remove(back0_img)
-        try:
-            os.remove(target_img)
-        except OSError:
-            pass
+        remove_test_image(source_img)
+        remove_test_image(back2_img)
+        remove_test_image(back1_img)
+        remove_test_image(back0_img)
+        remove_test_image(target_img)
 
     def findBlockNode(self, node_name, qdev=None):
         if qdev: