@@ -20,6 +20,7 @@
import os
import iotests
+from iotests import create_test_image, remove_test_image
import time
class TestStopWithBlockJob(iotests.QMPTestCase):
@@ -28,8 +29,8 @@ class TestStopWithBlockJob(iotests.QMPTestCase):
base_img = os.path.join(iotests.test_dir, 'base.img')
def setUp(self):
- iotests.qemu_img('create', '-f', iotests.imgfmt, self.base_img, "1G")
- iotests.qemu_img('create', '-f', iotests.imgfmt, self.test_img, "-b", self.base_img)
+ create_test_image(self.base_img, '1G')
+ create_test_image(self.test_img, backing_file=self.base_img)
iotests.qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x5d 1M 128M', self.test_img)
self.vm = iotests.VM().add_drive(self.test_img)
self.vm.launch()
@@ -46,6 +47,12 @@ class TestStopWithBlockJob(iotests.QMPTestCase):
result = self.vm.qmp("block_set_io_throttle", conv_keys=False,
**params)
self.vm.shutdown()
+ remove_test_image(self.test_img)
+ remove_test_image(self.base_img)
+ try:
+ os.remove(self.target_img)
+ except OSError:
+ pass
def do_test_stop(self, cmd, **args):
"""Test 'stop' while block job is running on a throttled drive.
Signed-off-by: Max Reitz <mreitz@redhat.com> --- tests/qemu-iotests/129 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)