[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 01/48] iotests: 124: Split into two test classes
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 01/48] iotests: 124: Split into two test classes |
Date: |
Fri, 18 Dec 2015 16:07:07 +0100 |
From: John Snow <address@hidden>
Split it into an abstract test class and an implementation class.
The split is primarily to facilitate more flexible setUp variations
for other kinds of tests without having to rewrite or shuffle around
all of these helpers.
See the following two patches for more of the "why."
Signed-off-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/124 | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124
index c928f01..778bfdd 100644
--- a/tests/qemu-iotests/124
+++ b/tests/qemu-iotests/124
@@ -91,24 +91,31 @@ class Bitmap:
try_remove(image)
-class TestIncrementalBackup(iotests.QMPTestCase):
- def setUp(self):
+class TestIncrementalBackupBase(iotests.QMPTestCase):
+ def __init__(self, *args):
+ super(TestIncrementalBackupBase, self).__init__(*args)
self.bitmaps = list()
self.files = list()
self.drives = list()
self.vm = iotests.VM()
self.err_img = os.path.join(iotests.test_dir, 'err.%s' %
iotests.imgfmt)
+
+ def setUp(self):
# Create a base image with a distinctive patterning
drive0 = self.add_node('drive0')
self.img_create(drive0['file'], drive0['fmt'])
self.vm.add_drive(drive0['file'])
- io_write_patterns(drive0['file'], (('0x41', 0, 512),
- ('0xd5', '1M', '32k'),
- ('0xdc', '32M', '124k')))
+ self.write_default_pattern(drive0['file'])
self.vm.launch()
+ def write_default_pattern(self, target):
+ io_write_patterns(target, (('0x41', 0, 512),
+ ('0xd5', '1M', '32k'),
+ ('0xdc', '32M', '124k')))
+
+
def add_node(self, node_id, fmt=iotests.imgfmt, path=None, backup=None):
if path is None:
path = os.path.join(iotests.test_dir, '%s.%s' % (node_id, fmt))
@@ -259,6 +266,16 @@ class TestIncrementalBackup(iotests.QMPTestCase):
self.check_backups()
+ def tearDown(self):
+ self.vm.shutdown()
+ for bitmap in self.bitmaps:
+ bitmap.cleanup()
+ for filename in self.files:
+ try_remove(filename)
+
+
+
+class TestIncrementalBackup(TestIncrementalBackupBase):
def test_incremental_simple(self):
'''
Test: Create and verify three incremental backups.
@@ -531,13 +548,5 @@ class TestIncrementalBackup(iotests.QMPTestCase):
granularity=64000)
- def tearDown(self):
- self.vm.shutdown()
- for bitmap in self.bitmaps:
- bitmap.cleanup()
- for filename in self.files:
- try_remove(filename)
-
-
if __name__ == '__main__':
iotests.main(supported_fmts=['qcow2'])
--
1.8.3.1
- [Qemu-block] [PULL 00/48] Block patches, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 01/48] iotests: 124: Split into two test classes,
Kevin Wolf <=
- [Qemu-block] [PULL 05/48] block: Fix reopen with semantically overlapping options, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 15/48] block: Split out parse_json_protocol(), Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 14/48] block: Add infrastructure for option inheritance, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 17/48] blockdev: Set 'format' indicates non-empty drive, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 19/48] block: reopen: Extract QemuOpts for generic block layer options, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 20/48] block: Move cache options into options QDict, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 21/48] blkdebug: Enable reopen, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 42/48] qemu-iotests: s390x: fix test 051, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 23/48] qemu-iotests: Test cache mode option inheritance, Kevin Wolf, 2015/12/18
- [Qemu-block] [PULL 02/48] iotests: 124: move incremental failure test, Kevin Wolf, 2015/12/18