@@ -23,7 +23,7 @@ import os
import stat
import time
import iotests
-from iotests import qemu_img
+from iotests import create_test_image, remove_test_image
old_img = os.path.join(iotests.test_dir, 'test0.img')
new_img = os.path.join(iotests.test_dir, 'test1.img')
@@ -301,8 +301,8 @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass):
was_empty = False
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, old_img, '1440k')
- qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k')
+ create_test_image(old_img, '1440k')
+ create_test_image(new_img, '1440k')
self.vm = iotests.VM()
if self.use_drive:
self.vm.add_drive(old_img, 'media=%s' % self.media, 'none')
@@ -320,8 +320,8 @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass):
def tearDown(self):
self.vm.shutdown()
- os.remove(old_img)
- os.remove(new_img)
+ remove_test_image(old_img)
+ remove_test_image(new_img)
def test_insert_on_filled(self):
result = self.vm.qmp('blockdev-add',
@@ -344,7 +344,7 @@ class TestInitiallyEmpty(GeneralChangeTestsBaseClass):
was_empty = True
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k')
+ create_test_image(new_img, '1440k')
self.vm = iotests.VM()
if self.use_drive:
self.vm.add_drive(None, 'media=%s' % self.media, 'none')
@@ -358,7 +358,7 @@ class TestInitiallyEmpty(GeneralChangeTestsBaseClass):
def tearDown(self):
self.vm.shutdown()
- os.remove(new_img)
+ remove_test_image(new_img)
def test_remove_on_empty(self):
result = self.vm.qmp('blockdev-open-tray', id=self.device_name)
@@ -394,16 +394,16 @@ class TestChangeReadOnly(ChangeBaseClass):
device_name = 'qdev0'
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, old_img, '1440k')
- qemu_img('create', '-f', iotests.imgfmt, new_img, '1440k')
+ create_test_image(old_img, '1440k')
+ create_test_image(new_img, '1440k')
self.vm = iotests.VM()
def tearDown(self):
self.vm.shutdown()
os.chmod(old_img, 0o666)
os.chmod(new_img, 0o666)
- os.remove(old_img)
- os.remove(new_img)
+ remove_test_image(old_img)
+ remove_test_image(new_img)
def test_ro_ro_retain(self):
os.chmod(old_img, 0o444)
@@ -640,7 +640,7 @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
device_name = 'qdev0'
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, old_img, '1440K')
+ create_test_image(old_img, '1440k')
self.vm = iotests.VM()
self.vm.add_drive_raw("id=drive0,driver=null-co,if=none")
@@ -674,7 +674,7 @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
def tearDown(self):
self.vm.shutdown()
- os.remove(old_img)
+ remove_test_image(old_img)
try:
os.remove(new_img)
except OSError:
Signed-off-by: Max Reitz <mreitz@redhat.com> --- tests/qemu-iotests/118 | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)