yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 54287567a2e235abe6967e15dd46eeebe8834f3b Mon Sep 17 00:00:00 2001
9ae3a8
From: Eric Blake <eblake@redhat.com>
9ae3a8
Date: Wed, 20 Aug 2014 16:40:13 +0200
9ae3a8
Subject: [PATCH 10/11] qemu-iotests: Test 0-length image for mirror
9ae3a8
9ae3a8
Message-id: <1408552814-23031-7-git-send-email-eblake@redhat.com>
9ae3a8
Patchwork-id: 60648
9ae3a8
O-Subject: [qemu-kvm-rhev 7.0.z PATCH 6/7] qemu-iotests: Test 0-length image for mirror
9ae3a8
Bugzilla: 1130603
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
All behavior and invariant should hold for images with 0 length, so
9ae3a8
add a class to repeat all the tests in TestSingleDrive.
9ae3a8
9ae3a8
Hide two unapplicable test methods that would fail with 0 image length
9ae3a8
because it's also used as cluster size.
9ae3a8
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 3b9f27d2b34cb8c5cc6cec993712c7e1943e9de9)
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	tests/qemu-iotests/041 - context due to no common event handling
9ae3a8
9ae3a8
Signed-off-by: Eric Blake <eblake@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 tests/qemu-iotests/041     |   11 ++++++++---
9ae3a8
 tests/qemu-iotests/041.out |    4 ++--
9ae3a8
 2 files changed, 10 insertions(+), 5 deletions(-)
9ae3a8
9ae3a8
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
9ae3a8
index bcfb759..912e499 100755
9ae3a8
--- a/tests/qemu-iotests/041
9ae3a8
+++ b/tests/qemu-iotests/041
9ae3a8
@@ -123,7 +123,7 @@ class TestSingleDrive(ImageMirroringTestCase):
9ae3a8
     image_len = 1 * 1024 * 1024 # MB
9ae3a8
 
9ae3a8
     def setUp(self):
9ae3a8
-        self.create_image(backing_img, TestSingleDrive.image_len)
9ae3a8
+        self.create_image(backing_img, self.image_len)
9ae3a8
         qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, test_img)
9ae3a8
         self.vm = iotests.VM().add_drive(test_img)
9ae3a8
         self.vm.launch()
9ae3a8
@@ -222,7 +222,7 @@ class TestSingleDrive(ImageMirroringTestCase):
9ae3a8
         self.assert_no_active_block_jobs()
9ae3a8
 
9ae3a8
         qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,size=%d'
9ae3a8
-                        % (TestSingleDrive.image_len, TestSingleDrive.image_len), target_img)
9ae3a8
+                        % (self.image_len, self.image_len), target_img)
9ae3a8
         result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
9ae3a8
                              buf_size=65536, mode='existing', target=target_img)
9ae3a8
         self.assert_qmp(result, 'return', {})
9ae3a8
@@ -238,7 +238,7 @@ class TestSingleDrive(ImageMirroringTestCase):
9ae3a8
         self.assert_no_active_block_jobs()
9ae3a8
 
9ae3a8
         qemu_img('create', '-f', iotests.imgfmt, '-o', 'cluster_size=%d,backing_file=%s'
9ae3a8
-                        % (TestSingleDrive.image_len, backing_img), target_img)
9ae3a8
+                        % (self.image_len, backing_img), target_img)
9ae3a8
         result = self.vm.qmp('drive-mirror', device='drive0', sync='full',
9ae3a8
                              mode='existing', target=target_img)
9ae3a8
         self.assert_qmp(result, 'return', {})
9ae3a8
@@ -265,6 +265,11 @@ class TestSingleDrive(ImageMirroringTestCase):
9ae3a8
                              target=target_img)
9ae3a8
         self.assert_qmp(result, 'error/class', 'DeviceNotFound')
9ae3a8
 
9ae3a8
+class TestSingleDriveZeroLength(TestSingleDrive):
9ae3a8
+    image_len = 0
9ae3a8
+    test_small_buffer2 = None
9ae3a8
+    test_large_cluster = None
9ae3a8
+
9ae3a8
 class TestMirrorNoBacking(ImageMirroringTestCase):
9ae3a8
     image_len = 2 * 1024 * 1024 # MB
9ae3a8
 
9ae3a8
diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out
9ae3a8
index 6d9bee1..cfa5c0d 100644
9ae3a8
--- a/tests/qemu-iotests/041.out
9ae3a8
+++ b/tests/qemu-iotests/041.out
9ae3a8
@@ -1,5 +1,5 @@
9ae3a8
-...........................
9ae3a8
+...................................
9ae3a8
 ----------------------------------------------------------------------
9ae3a8
-Ran 27 tests
9ae3a8
+Ran 35 tests
9ae3a8
 
9ae3a8
 OK
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8