From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0bWZ-0004ir-Dz for qemu-devel@nongnu.org; Fri, 27 Jun 2014 15:09:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0bWQ-0006q3-84 for qemu-devel@nongnu.org; Fri, 27 Jun 2014 15:09:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21022) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0bWP-0006py-VE for qemu-devel@nongnu.org; Fri, 27 Jun 2014 15:09:18 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5RJ9Gx8000549 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 27 Jun 2014 15:09:17 -0400 From: Kevin Wolf Date: Fri, 27 Jun 2014 21:08:23 +0200 Message-Id: <1403896146-3063-5-git-send-email-kwolf@redhat.com> In-Reply-To: <1403896146-3063-1-git-send-email-kwolf@redhat.com> References: <1403896146-3063-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 04/47] qemu-iotests: Test 0-length image for mirror List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Fam Zheng 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 Signed-off-by: Kevin Wolf --- tests/qemu-iotests/041 | 11 ++++++++--- tests/qemu-iotests/041.out | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index ec470b2..ef4f465 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -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 diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out index 6d9bee1..cfa5c0d 100644 --- a/tests/qemu-iotests/041.out +++ b/tests/qemu-iotests/041.out @@ -1,5 +1,5 @@ -........................... +................................... ---------------------------------------------------------------------- -Ran 27 tests +Ran 35 tests OK -- 1.8.3.1