From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbuUy-0004Of-Kp for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbuUt-0004Nn-8b for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbuUs-0004NU-JD for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:23 -0400 From: Kevin Wolf Date: Thu, 31 Oct 2013 16:48:32 +0100 Message-Id: <1383234524-372-19-git-send-email-kwolf@redhat.com> In-Reply-To: <1383234524-372-1-git-send-email-kwolf@redhat.com> References: <1383234524-372-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 18/30] qemu-iotests: drop duplicated "create_image" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Fam Zheng There's a same common function in iotests.py Signed-off-by: Fam Zheng Signed-off-by: Kevin Wolf --- tests/qemu-iotests/040 | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index aad535a..a2e18c5 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) -- 1.8.1.4