[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 21/30] qemu-iotests: add test for pausing a streamin
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 21/30] qemu-iotests: add test for pausing a streaming operation |
Date: |
Fri, 28 Sep 2012 19:57:04 +0200 |
From: Paolo Bonzini <address@hidden>
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/030 | 40 ++++++++++++++++++++++++++++++++++++++--
tests/qemu-iotests/030.out | 4 ++--
tests/qemu-iotests/group | 2 +-
3 files changed, 41 insertions(+), 5 deletions(-)
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 4b54fa6..66d2ba9 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.6.5
- [Qemu-devel] [PATCH 04/30] qemu: URI parsing library, (continued)
- [Qemu-devel] [PATCH 04/30] qemu: URI parsing library, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 12/30] QAPI: add command for live block commit, 'block-commit', Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 13/30] qemu-iotests: add initial tests for live block commit, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 14/30] qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 15/30] block: fix documentation of block_job_cancel_sync, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 17/30] block: add block_job_query, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 18/30] qmp: add 'busy' member to BlockJobInfo, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 16/30] block: move job APIs to separate files, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 19/30] block: add support for job pause/resume, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 20/30] qmp: add block-job-pause and block-job-resume, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 21/30] qemu-iotests: add test for pausing a streaming operation,
Kevin Wolf <=
- [Qemu-devel] [PATCH 30/30] qemu-iotests: add tests for streaming error handling, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 26/30] block: introduce block job error, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 27/30] stream: add on-error argument, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 24/30] iostatus: change is_read to a bool, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 28/30] blkdebug: process all set_state rules in the old state, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 22/30] iostatus: rename BlockErrorAction, BlockQMPEventAction, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 23/30] iostatus: move BlockdevOnError declaration to QAPI, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 29/30] qemu-iotests: map underscore to dash in QMP argument names, Kevin Wolf, 2012/09/28
- [Qemu-devel] [PATCH 25/30] iostatus: reorganize io error code, Kevin Wolf, 2012/09/28