@@ -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),
Signed-off-by: Max Reitz <mreitz@redhat.com> --- tests/qemu-iotests/163 | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)