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