qemu-iotests: Test 0-length image for mirror
All behavior and invariant should hold for images with 0 length, so add a class to repeat all the tests in TestSingleDrive. Hide two unapplicable test methods that would fail with 0 image length because it's also used as cluster size. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
8b9a30ca5b
commit
3b9f27d2b3
@ -64,7 +64,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
||||
image_len = 1 * 1024 * 1024 # MB
|
||||
|
||||
def setUp(self):
|
||||
iotests.create_image(backing_img, TestSingleDrive.image_len)
|
||||
iotests.create_image(backing_img, self.image_len)
|
||||
qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
|
||||
self.vm = iotests.VM().add_drive(test_img)
|
||||
self.vm.launch()
|
||||
@ -163,7 +163,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
||||
self.assert_no_active_block_jobs()
|
||||
|
||||
qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,size=%d'
|
||||
% (TestSingleDrive.image_len, TestSingleDrive.image_len), target_img)
|
||||
% (self.image_len, self.image_len), target_img)
|
||||
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
||||
buf_size=65536, mode='existing', target=target_img)
|
||||
self.assert_qmp(result, 'return', {})
|
||||
@ -179,7 +179,7 @@ class TestSingleDrive(ImageMirroringTestCase):
|
||||
self.assert_no_active_block_jobs()
|
||||
|
||||
qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,backing_file=%s'
|
||||
% (TestSingleDrive.image_len, backing_img), target_img)
|
||||
% (self.image_len, backing_img), target_img)
|
||||
result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
|
||||
mode='existing', target=target_img)
|
||||
self.assert_qmp(result, 'return', {})
|
||||
@ -206,6 +206,11 @@ class TestSingleDrive(ImageMirroringTestCase):
|
||||
target=target_img)
|
||||
self.assert_qmp(result, 'error/class', 'DeviceNotFound')
|
||||
|
||||
class TestSingleDriveZeroLength(TestSingleDrive):
|
||||
image_len = 0
|
||||
test_small_buffer2 = None
|
||||
test_large_cluster = None
|
||||
|
||||
class TestMirrorNoBacking(ImageMirroringTestCase):
|
||||
image_len = 2 * 1024 * 1024 # MB
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
...........................
|
||||
...................................
|
||||
----------------------------------------------------------------------
|
||||
Ran 27 tests
|
||||
Ran 35 tests
|
||||
|
||||
OK
|
||||
|
Loading…
Reference in New Issue
Block a user