[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 19/26] stream: add testcase for partial streaming
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 19/26] stream: add testcase for partial streaming |
Date: |
Thu, 12 Apr 2012 14:01:09 +0200 |
Signed-off-by: Paolo Bonzini <address@hidden>
---
tests/qemu-iotests/030 | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 3efb6cd..9c74dd2 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -23,6 +23,7 @@ import iotests
from iotests import qemu_img, qemu_io
backing_img = os.path.join(iotests.test_dir, 'backing.img')
+mid_img = os.path.join(iotests.test_dir, 'mid.img')
test_img = os.path.join(iotests.test_dir, 'test.img')
class ImageStreamingTestCase(iotests.QMPTestCase):
@@ -37,7 +38,8 @@ class TestSingleDrive(ImageStreamingTestCase):
def setUp(self):
qemu_img('create', backing_img, str(TestSingleDrive.image_len))
- qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' %
backing_img, test_img)
+ 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)
self.vm = iotests.VM().add_drive(test_img)
self.vm.launch()
@@ -68,6 +70,29 @@ class TestSingleDrive(ImageStreamingTestCase):
self.assertFalse('sectors not allocated' in qemu_io('-c', 'map',
test_img),
'image file not fully populated after streaming')
+ def test_stream_partial(self):
+ self.assert_no_active_streams()
+
+ result = self.vm.qmp('block_stream', device='drive0', base=mid_img)
+ self.assert_qmp(result, 'return', {})
+
+ completed = False
+ while not completed:
+ for event in self.vm.get_qmp_events(wait=True):
+ if event['event'] == 'BLOCK_JOB_COMPLETED':
+ self.assert_qmp(event, 'data/type', 'stream')
+ self.assert_qmp(event, 'data/device', 'drive0')
+ self.assert_qmp(event, 'data/offset', self.image_len)
+ self.assert_qmp(event, 'data/len', self.image_len)
+ completed = True
+
+ self.assert_no_active_streams()
+ self.vm.shutdown()
+
+ self.assertEqual(qemu_io('-c', 'map', mid_img),
+ qemu_io('-c', 'map', test_img),
+ 'image file map does not match backing file after
streaming')
+
def test_device_not_found(self):
result = self.vm.qmp('block_stream', device='nonexistent')
self.assert_qmp(result, 'error/class', 'DeviceNotFound')
--
1.7.9.3
- [Qemu-devel] [PATCH 13/26] block: open backing file as read-only when probing for size, (continued)
- [Qemu-devel] [PATCH 13/26] block: open backing file as read-only when probing for size, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 22/26] stream: do not copy unallocated sectors from the base, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 23/26] block: implement is_allocated for raw, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 24/26] stream: tweak usage of bdrv_co_is_allocated, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 16/26] qemu-io: correctly print non-integer values as decimals, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 25/26] stream: move is_allocated_above to block.c, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 17/26] qemu-io: fix the alloc command, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 15/26] qemu-iotests: strip spaces from qemu-img/qemu-io/qemu command lines, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 21/26] stream: fix ratelimiting corner case, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 18/26] stream: fix sectors not allocated test, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 19/26] stream: add testcase for partial streaming,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 26/26] stream: move rate limiting to a separate header file, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 20/26] stream: pass new base image format to bdrv_change_backing_file, Paolo Bonzini, 2012/04/12
- [Qemu-devel] [PATCH 27/26] block: another bdrv_append fix, Paolo Bonzini, 2012/04/17