thebeanogamer / rpms / qemu-kvm

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