qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH 1.1 14/22] stream: add testcase for partial streaming
Date: Tue,  8 May 2012 16:51:54 +0200	[thread overview]
Message-ID: <1336488722-13120-15-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1336488722-13120-1-git-send-email-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/030     |   27 ++++++++++++++++++++++++++-
 tests/qemu-iotests/030.out |    4 ++--
 2 file changed, 28 insertions(+), 3 deletion(-)

diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out
index 0d2f87b..0aa7a0a 100644
--- a/tests/qemu-iotests/030.out
+++ b/tests/qemu-iotests/030.out
@@ -1,5 +1,5 @@
-.....
+......
 ----------------------------------------------------------------------
-Ran 5 tests
+Ran 6 tests
 
 OK
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 0d2f87b..0aa7a0a 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):
@@ -52,7 +53,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()
 
@@ -83,6 +85,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.10.1

  parent reply	other threads:[~2012-05-08 14:53 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08 14:51 [Qemu-devel] [PATCH 1.1 00/22] Rebased queue of block patches Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 01/22] block: fix snapshot on QED Paolo Bonzini
2012-05-09 12:15   ` Kevin Wolf
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 02/22] block: another bdrv_append fix Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 03/22] block: do not reuse the backing file across bdrv_close/bdrv_open Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 04/22] block: fully delete bs->file when closing Paolo Bonzini
2012-05-09 12:22   ` Kevin Wolf
2012-05-09 12:59     ` Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 05/22] block: add block_job_sleep_ns Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 06/22] block: wait for job callback in block_job_cancel_sync Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 07/22] block: simplify path_is_absolute Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 08/22] block: protect path_has_protocol from filenames with colons Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 09/22] block: move field reset from bdrv_open_common to bdrv_close Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 10/22] qemu-img: make "info" backing file output correct and easier to use Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 11/22] qemu-io: correctly print non-integer values as decimals Paolo Bonzini
2012-05-09 12:46   ` Kevin Wolf
2012-05-09 12:48     ` Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 12/22] qemu-io: fix the alloc command Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 13/22] stream: fix sectors not allocated test Paolo Bonzini
2012-05-08 14:51 ` Paolo Bonzini [this message]
2012-05-09 12:59   ` [Qemu-devel] [PATCH 1.1 14/22] stream: add testcase for partial streaming Kevin Wolf
2012-05-09 13:05     ` [Qemu-devel] [PATCH 1.1 v2 " Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 15/22] stream: pass new base image format to bdrv_change_backing_file Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 16/22] stream: fix HMP block_job_set_speed Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 17/22] stream: fix ratelimiting corner case Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 18/22] stream: do not copy unallocated sectors from the base Paolo Bonzini
2012-05-08 14:51 ` [Qemu-devel] [PATCH 1.1 19/22] block: implement is_allocated for raw Paolo Bonzini
2012-05-09 13:40   ` Kevin Wolf
2012-05-09 14:05     ` Paolo Bonzini
2012-05-09 14:10       ` Kevin Wolf
2012-05-09 14:24         ` Paolo Bonzini
2012-05-09 14:49           ` [Qemu-devel] [PATCH next v2 " Paolo Bonzini
2012-05-08 14:52 ` [Qemu-devel] [PATCH 1.1 20/22] stream: tweak usage of bdrv_co_is_allocated Paolo Bonzini
2012-05-08 14:52 ` [Qemu-devel] [PATCH 1.1 21/22] stream: move is_allocated_above to block.c Paolo Bonzini
2012-05-08 14:52 ` [Qemu-devel] [PATCH 1.1 22/22] stream: move rate limiting to a separate header file Paolo Bonzini
2012-05-09 13:52   ` Kevin Wolf
2012-05-09 14:09     ` [Qemu-devel] [PATCH 1.1 v2 " Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1336488722-13120-15-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).