[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 20/67] iotests/055: Honor $IMGOPTS
From: |
Max Reitz |
Subject: |
[PATCH 20/67] iotests/055: Honor $IMGOPTS |
Date: |
Tue, 1 Oct 2019 21:46:28 +0200 |
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/055 | 41 +++++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055
index c732a112d6..e44f18570d 100755
--- a/tests/qemu-iotests/055
+++ b/tests/qemu-iotests/055
@@ -23,7 +23,7 @@
import time
import os
import iotests
-from iotests import qemu_img, qemu_io
+from iotests import create_test_image, remove_test_image, qemu_io
test_img = os.path.join(iotests.test_dir, 'test.img')
target_img = os.path.join(iotests.test_dir, 'target.img')
@@ -32,7 +32,7 @@ blockdev_target_img = os.path.join(iotests.test_dir,
'blockdev-target.img')
image_len = 64 * 1024 * 1024 # MB
def setUpModule():
- qemu_img('create', '-f', iotests.imgfmt, test_img, str(image_len))
+ create_test_image(test_img, image_len)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x11 0 64k', test_img)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x00 64k 128k', test_img)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x22 162k 32k', test_img)
@@ -41,12 +41,12 @@ def setUpModule():
qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x33 67043328 64k', test_img)
def tearDownModule():
- os.remove(test_img)
+ remove_test_image(test_img)
class TestSingleDrive(iotests.QMPTestCase):
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img,
str(image_len))
+ create_test_image(blockdev_target_img, image_len)
self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
self.vm.add_drive(blockdev_target_img, interface="none")
@@ -56,7 +56,7 @@ class TestSingleDrive(iotests.QMPTestCase):
def tearDown(self):
self.vm.shutdown()
- os.remove(blockdev_target_img)
+ remove_test_image(blockdev_target_img)
try:
os.remove(target_img)
except OSError:
@@ -163,7 +163,7 @@ class TestSingleDrive(iotests.QMPTestCase):
class TestSetSpeed(iotests.QMPTestCase):
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img,
str(image_len))
+ create_test_image(blockdev_target_img, image_len)
self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
self.vm.add_drive(blockdev_target_img, interface="none")
@@ -171,7 +171,7 @@ class TestSetSpeed(iotests.QMPTestCase):
def tearDown(self):
self.vm.shutdown()
- os.remove(blockdev_target_img)
+ remove_test_image(blockdev_target_img)
try:
os.remove(target_img)
except OSError:
@@ -249,7 +249,7 @@ class TestSetSpeed(iotests.QMPTestCase):
# would stall. Instead, we limit the block job speed here.
class TestSingleTransaction(iotests.QMPTestCase):
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, blockdev_target_img,
str(image_len))
+ create_test_image(blockdev_target_img, image_len)
self.vm = iotests.VM().add_drive(test_img)
self.vm.add_drive(blockdev_target_img, interface="none")
@@ -259,7 +259,7 @@ class TestSingleTransaction(iotests.QMPTestCase):
def tearDown(self):
self.vm.shutdown()
- os.remove(blockdev_target_img)
+ remove_test_image(blockdev_target_img)
try:
os.remove(target_img)
except OSError:
@@ -452,29 +452,34 @@ class TestSingleTransaction(iotests.QMPTestCase):
class TestDriveCompression(iotests.QMPTestCase):
image_len = 64 * 1024 * 1024 # MB
- fmt_supports_compression = [{'type': 'qcow2', 'args': ()},
- {'type': 'vmdk', 'args': ('-o',
'subformat=streamOptimized')}]
+ fmt_supports_compression = [{'type': 'qcow2', 'opts': []},
+ {'type': 'vmdk', 'opts':
['subformat=streamOptimized']}]
+
+ # Compression does not work with external data files
+ @iotests.skip_for_imgopts(['data_file'])
+ def setUp(self):
+ pass
def tearDown(self):
self.vm.shutdown()
- os.remove(blockdev_target_img)
+ remove_test_image(blockdev_target_img)
try:
os.remove(target_img)
except OSError:
pass
- def do_prepare_drives(self, fmt, args, attach_target):
+ def do_prepare_drives(self, fmt, opts, attach_target):
self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
- qemu_img('create', '-f', fmt, blockdev_target_img,
- str(TestDriveCompression.image_len), *args)
+ create_test_image(blockdev_target_img, TestDriveCompression.image_len,
+ fmt=fmt, opts=opts)
if attach_target:
self.vm.add_drive(blockdev_target_img, format=fmt,
interface="none")
self.vm.launch()
def do_test_compress_complete(self, cmd, format, attach_target, **args):
- self.do_prepare_drives(format['type'], format['args'], attach_target)
+ self.do_prepare_drives(format['type'], format['opts'], attach_target)
self.assert_no_active_block_jobs()
@@ -499,7 +504,7 @@ class TestDriveCompression(iotests.QMPTestCase):
target='drive1')
def do_test_compress_cancel(self, cmd, format, attach_target, **args):
- self.do_prepare_drives(format['type'], format['args'], attach_target)
+ self.do_prepare_drives(format['type'], format['opts'], attach_target)
self.assert_no_active_block_jobs()
@@ -523,7 +528,7 @@ class TestDriveCompression(iotests.QMPTestCase):
target='drive1')
def do_test_compress_pause(self, cmd, format, attach_target, **args):
- self.do_prepare_drives(format['type'], format['args'], attach_target)
+ self.do_prepare_drives(format['type'], format['opts'], attach_target)
self.assert_no_active_block_jobs()
--
2.21.0
- [PATCH 14/67] iotests: Use unsupported_imgopts in Python tests, (continued)
- [PATCH 14/67] iotests: Use unsupported_imgopts in Python tests, Max Reitz, 2019/10/01
- [PATCH 10/67] iotests/169: Skip persistent cases for compat=0.10, Max Reitz, 2019/10/01
- [PATCH 15/67] iotests/030: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 18/67] iotests/044: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 16/67] iotests/040: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 17/67] iotests/041: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 19/67] iotests/045: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 21/67] iotests/056: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 22/67] iotests/057: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 23/67] iotests/065: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 20/67] iotests/055: Honor $IMGOPTS,
Max Reitz <=
- [PATCH 24/67] iotests/096: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 25/67] iotests/118: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 28/67] iotests/132: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 26/67] iotests/124: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 27/67] iotests/129: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 29/67] iotests/139: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 30/67] iotests/147: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 32/67] iotests/151: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 31/67] iotests/148: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 33/67] iotests/152: Honor $IMGOPTS, Max Reitz, 2019/10/01