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
Subject: [Qemu-devel] [PATCH 09/19] qemu-iotests: add test for pausing a streaming operation
Date: Fri, 28 Sep 2012 17:22:52 +0200	[thread overview]
Message-ID: <1348845782-15073-10-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1348845782-15073-1-git-send-email-pbonzini@redhat.com>

These check that a paused streaming job does not advance its offset.

Sometimes the new test fails; the map is different between the source
and the destination of the streaming because qemu-io does not always
pack adjacent clusters that have the same allocated/unallocated state.
However, this also happens with the existing test_stream testcase, and
is better fixed in qemu-io.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/030     | 40 ++++++++++++++++++++++++++++++++++++++--
 tests/qemu-iotests/030.out |  4 ++--
 tests/qemu-iotests/group   |  2 +-
 3 file modificati, 41 inserzioni(+), 5 rimozioni(-)

diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 55b16f8..dfacdf1 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+import time
 import os
 import iotests
 from iotests import qemu_img, qemu_io
@@ -98,6 +99,43 @@ class TestSingleDrive(ImageStreamingTestCase):
                          qemu_io('-c', 'map', test_img),
                          'image file map does not match backing file after streaming')
 
+    def test_stream_pause(self):
+        self.assert_no_active_streams()
+
+        result = self.vm.qmp('block-stream', device='drive0')
+        self.assert_qmp(result, 'return', {})
+
+        result = self.vm.qmp('block-job-pause', device='drive0')
+        self.assert_qmp(result, 'return', {})
+
+        time.sleep(1)
+        result = self.vm.qmp('query-block-jobs')
+        offset = self.dictpath(result, 'return[0]/offset')
+
+        time.sleep(1)
+        result = self.vm.qmp('query-block-jobs')
+        self.assert_qmp(result, 'return[0]/offset', offset)
+
+        result = self.vm.qmp('block-job-resume', device='drive0')
+        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', backing_img),
+                         qemu_io('-c', 'map', test_img),
+                         'image file map does not match backing file after streaming')
+
     def test_stream_partial(self):
         self.assert_no_active_streams()
 
@@ -173,8 +211,6 @@ class TestStreamStop(ImageStreamingTestCase):
         os.remove(backing_img)
 
     def test_stream_stop(self):
-        import time
-
         self.assert_no_active_streams()
 
         result = self.vm.qmp('block-stream', device='drive0')
diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out
index 2f7d390..594c16f 100644
--- a/tests/qemu-iotests/030.out
+++ b/tests/qemu-iotests/030.out
@@ -1,5 +1,5 @@
-.......
+........
 ----------------------------------------------------------------------
-Ran 7 tests
+Ran 8 tests
 
 OK
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index ebb5ca4..fa4da7d 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -36,7 +36,7 @@
 027 rw auto quick
 028 rw backing auto
 029 rw auto quick
-030 rw auto
+030 rw auto backing
 031 rw auto quick
 032 rw auto
 033 rw auto
-- 
1.7.12

  parent reply	other threads:[~2012-09-28 15:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 15:22 [Qemu-devel] [PULL for Kevin 00/19] Block job improvements part 1 Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 01/19] qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 02/19] blockdev: rename block_stream_cb to a generic block_job_cb Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 03/19] block: fix documentation of block_job_cancel_sync Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 04/19] block: move job APIs to separate files Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 05/19] block: add block_job_query Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 06/19] qmp: add 'busy' member to BlockJobInfo Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 07/19] block: add support for job pause/resume Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 08/19] qmp: add block-job-pause and block-job-resume Paolo Bonzini
2012-09-28 15:22 ` Paolo Bonzini [this message]
2012-09-28 15:22 ` [Qemu-devel] [PATCH 10/19] block: rename block_job_complete to block_job_completed Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 11/19] iostatus: rename BlockErrorAction, BlockQMPEventAction Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 12/19] iostatus: move BlockdevOnError declaration to QAPI Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 13/19] iostatus: change is_read to a bool Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 14/19] iostatus: reorganize io error code Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 15/19] block: introduce block job error Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 16/19] stream: add on-error argument Paolo Bonzini
2012-09-28 15:23 ` [Qemu-devel] [PATCH 17/19] blkdebug: process all set_state rules in the old state Paolo Bonzini
2012-09-28 15:23 ` [Qemu-devel] [PATCH 18/19] qemu-iotests: map underscore to dash in QMP argument names Paolo Bonzini
2012-09-28 15:23 ` [Qemu-devel] [PATCH 19/19] qemu-iotests: add tests for streaming error handling Paolo Bonzini
2012-09-28 15:57 ` [Qemu-devel] [PULL for Kevin 00/19] Block job improvements part 1 Eric Blake
2012-09-28 18:23 ` Kevin Wolf
2012-10-01 13:37   ` 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=1348845782-15073-10-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).