[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/41] iotests: add pause_wait
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 06/41] iotests: add pause_wait |
Date: |
Tue, 13 Mar 2018 17:17:28 +0100 |
From: John Snow <address@hidden>
Split out the pause command into the actual pause and the wait.
Not every usage presently needs to resubmit a pause request.
The intent with the next commit will be to explicitly disallow
redundant or meaningless pause/resume requests, so the tests
need to become more judicious to reflect that.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/030 | 6 ++----
tests/qemu-iotests/055 | 17 ++++++-----------
tests/qemu-iotests/iotests.py | 12 ++++++++----
3 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index b5f88959aa..640a6dfd10 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -86,11 +86,9 @@ class TestSingleDrive(iotests.QMPTestCase):
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', {})
-
+ self.pause_job('drive0', wait=False)
self.vm.resume_drive('drive0')
- self.pause_job('drive0')
+ self.pause_wait('drive0')
result = self.vm.qmp('query-block-jobs')
offset = self.dictpath(result, 'return[0]/offset')
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055
index 8a5d9fd269..3437c11507 100755
--- a/tests/qemu-iotests/055
+++ b/tests/qemu-iotests/055
@@ -86,11 +86,9 @@ class TestSingleDrive(iotests.QMPTestCase):
target=target, sync='full')
self.assert_qmp(result, 'return', {})
- result = self.vm.qmp('block-job-pause', device='drive0')
- self.assert_qmp(result, 'return', {})
-
+ self.pause_job('drive0', wait=False)
self.vm.resume_drive('drive0')
- self.pause_job('drive0')
+ self.pause_wait('drive0')
result = self.vm.qmp('query-block-jobs')
offset = self.dictpath(result, 'return[0]/offset')
@@ -303,13 +301,12 @@ class TestSingleTransaction(iotests.QMPTestCase):
])
self.assert_qmp(result, 'return', {})
- result = self.vm.qmp('block-job-pause', device='drive0')
- self.assert_qmp(result, 'return', {})
+ self.pause_job('drive0', wait=False)
result = self.vm.qmp('block-job-set-speed', device='drive0', speed=0)
self.assert_qmp(result, 'return', {})
- self.pause_job('drive0')
+ self.pause_wait('drive0')
result = self.vm.qmp('query-block-jobs')
offset = self.dictpath(result, 'return[0]/offset')
@@ -534,11 +531,9 @@ class TestDriveCompression(iotests.QMPTestCase):
result = self.vm.qmp(cmd, device='drive0', sync='full', compress=True,
**args)
self.assert_qmp(result, 'return', {})
- result = self.vm.qmp('block-job-pause', device='drive0')
- self.assert_qmp(result, 'return', {})
-
+ self.pause_job('drive0', wait=False)
self.vm.resume_drive('drive0')
- self.pause_job('drive0')
+ self.pause_wait('drive0')
result = self.vm.qmp('query-block-jobs')
offset = self.dictpath(result, 'return[0]/offset')
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 1bcc9ca57d..5303bbc8e2 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -473,10 +473,7 @@ class QMPTestCase(unittest.TestCase):
event = self.wait_until_completed(drive=drive)
self.assert_qmp(event, 'data/type', 'mirror')
- def pause_job(self, job_id='job0'):
- result = self.vm.qmp('block-job-pause', device=job_id)
- self.assert_qmp(result, 'return', {})
-
+ def pause_wait(self, job_id='job0'):
with Timeout(1, "Timeout waiting for job to pause"):
while True:
result = self.vm.qmp('query-block-jobs')
@@ -484,6 +481,13 @@ class QMPTestCase(unittest.TestCase):
if job['device'] == job_id and job['paused'] == True and
job['busy'] == False:
return job
+ def pause_job(self, job_id='job0', wait=True):
+ result = self.vm.qmp('block-job-pause', device=job_id)
+ self.assert_qmp(result, 'return', {})
+ if wait:
+ return self.pause_wait(job_id)
+ return result
+
def notrun(reason):
'''Skip this test suite'''
--
2.13.6
- [Qemu-devel] [PULL 13/41] blockjobs: add commit, abort, clean helpers, (continued)
- [Qemu-devel] [PULL 13/41] blockjobs: add commit, abort, clean helpers, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 07/41] blockjobs: add block_job_verb permission table, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 08/41] blockjobs: add ABORTING state, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 15/41] blockjobs: add prepare callback, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 12/41] blockjobs: ensure abort is called for cancelled jobs, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 16/41] blockjobs: add waiting status, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 18/41] blockjobs: add block-job-finalize, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 04/41] blockjobs: add status enum, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 10/41] blockjobs: add NULL state, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 11/41] blockjobs: add block_job_dismiss, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 06/41] iotests: add pause_wait,
Kevin Wolf <=
- [Qemu-devel] [PULL 23/41] luks: Create block_crypto_co_create_generic(), Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 17/41] blockjobs: add PENDING status and event, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 25/41] luks: Turn invalid assertion into check, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 20/41] iotests: test manual job dismissal, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 05/41] blockjobs: add state transition table, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 09/41] blockjobs: add CONCLUDED state, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 14/41] blockjobs: add block_job_txn_apply function, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 32/41] iotests: Add regression test for commit base locking, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 21/41] tests/test-blockjob: test cancellations, Kevin Wolf, 2018/03/13
- [Qemu-devel] [PULL 19/41] blockjobs: Expose manual property, Kevin Wolf, 2018/03/13