diff options
author | Fam Zheng <famz@redhat.com> | 2013-10-30 17:23:54 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-10-30 11:58:46 +0100 |
commit | 915365a9c622be52c87fcc1cc9d63fbc5cd75b6d (patch) | |
tree | 6b4304961537a2c624c2ccdcfbf32073274e1cd0 | |
parent | a7cf03d4e150abec88f5837461242dc8a0eee189 (diff) |
qemu-iotests: drop duplicated "create_image"
There's a same common function in iotests.py
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rwxr-xr-x | tests/qemu-iotests/040 | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index aad535a74b..a2e18c56d4 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -54,22 +54,12 @@ class ImageCommitTestCase(iotests.QMPTestCase): self.assert_no_active_commit() - def create_image(self, name, size): - file = open(name, 'w') - i = 0 - while i < size: - sector = struct.pack('>l504xl', i / 512, i / 512) - file.write(sector) - i = i + 512 - file.close() - - class TestSingleDrive(ImageCommitTestCase): image_len = 1 * 1024 * 1024 test_len = 1 * 1024 * 256 def setUp(self): - self.create_image(backing_img, TestSingleDrive.image_len) + iotests.create_image(backing_img, TestSingleDrive.image_len) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, mid_img) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % mid_img, test_img) qemu_io('-c', 'write -P 0xab 0 524288', backing_img) @@ -167,7 +157,7 @@ class TestRelativePaths(ImageCommitTestCase): except OSError as exception: if exception.errno != errno.EEXIST: raise - self.create_image(self.backing_img_abs, TestRelativePaths.image_len) + iotests.create_image(self.backing_img_abs, TestRelativePaths.image_len) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % self.backing_img_abs, self.mid_img_abs) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % self.mid_img_abs, self.test_img) qemu_img('rebase', '-u', '-b', self.backing_img, self.mid_img_abs) |