diff mbox series

[35/67] iotests/163: Honor $IMGOPTS

Message ID 20191001194715.2796-36-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/163 | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/tests/qemu-iotests/163 b/tests/qemu-iotests/163
index 92633f1b21..5c5e23f9fc 100755
--- a/tests/qemu-iotests/163
+++ b/tests/qemu-iotests/163
@@ -19,7 +19,8 @@ 
 #
 
 import os, random, iotests, struct, qcow2, sys
-from iotests import qemu_img, qemu_io, image_size
+from iotests import create_test_image, remove_test_image, qemu_img, qemu_io, \
+        image_size
 
 test_img = os.path.join(iotests.test_dir, 'test.img')
 check_img = os.path.join(iotests.test_dir, 'check.img')
@@ -82,22 +83,19 @@  class ShrinkBaseClass(iotests.QMPTestCase):
 
     def setUp(self):
         if iotests.imgfmt == 'raw':
-            qemu_img('create', '-f', iotests.imgfmt, test_img, self.image_len)
-            qemu_img('create', '-f', iotests.imgfmt, check_img,
-                     self.shrink_size)
+            create_test_image(test_img, self.image_len)
+            create_test_image(check_img, self.shrink_size)
         else:
-            qemu_img('create', '-f', iotests.imgfmt,
-                     '-o', 'cluster_size=' + self.cluster_size +
-                     ',refcount_bits=' + self.refcount_bits,
-                     test_img, self.image_len)
-            qemu_img('create', '-f', iotests.imgfmt,
-                     '-o', 'cluster_size=%s'% self.cluster_size,
-                     check_img, self.shrink_size)
+            create_test_image(test_img, self.image_len,
+                              opts=['cluster_size=' + self.cluster_size,
+                                    'refcount_bits=' + self.refcount_bits])
+            create_test_image(check_img, self.shrink_size,
+                              opts=['cluster_size=' + self.cluster_size])
         qemu_io('-c', 'write -P 0xff 0 ' + self.shrink_size, check_img)
 
     def tearDown(self):
-        os.remove(test_img)
-        os.remove(check_img)
+        remove_test_image(test_img)
+        remove_test_image(check_img)
 
     def image_verify(self):
         self.assertEqual(image_size(test_img), image_size(check_img),