[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 14/18] iotests: teach run_job to cancel pending j
From: |
John Snow |
Subject: |
[Qemu-devel] [PATCH v2 14/18] iotests: teach run_job to cancel pending jobs |
Date: |
Wed, 3 Jul 2019 17:55:38 -0400 |
run_job can cancel pending jobs to simulate failure. This lets us use
the pending callback to issue test commands while the job is open, but
then still have the job fail in the end.
Signed-off-by: John Snow <address@hidden>
---
tests/qemu-iotests/iotests.py | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index fcad957d63..c544659ecb 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -541,7 +541,22 @@ class VM(qtest.QEMUQtestMachine):
# Returns None on success, and an error string on failure
def run_job(self, job, auto_finalize=True, auto_dismiss=False,
- pre_finalize=None, wait=60.0):
+ pre_finalize=None, cancel=False, wait=60.0):
+ """
+ run_job moves a job from creation through to dismissal.
+
+ :param job: String. ID of recently-launched job
+ :param auto_finalize: Bool. True if the job was launched with
+ auto_finalize. Defaults to True.
+ :param auto_dismiss: Bool. True if the job was launched with
+ auto_dismiss=True. Defaults to False.
+ :param pre_finalize: Callback. A callable that takes no arguments to be
+ invoked prior to issuing job-finalize, if any.
+ :param cancel: Bool. When true, cancels the job after the pre_finalize
+ callback.
+ :param wait: Float. Timeout value specifying how long to wait for any
+ event, in seconds. Defaults to 60.0.
+ """
match_device = {'data': {'device': job}}
match_id = {'data': {'id': job}}
events = [
@@ -568,7 +583,10 @@ class VM(qtest.QEMUQtestMachine):
elif status == 'pending' and not auto_finalize:
if pre_finalize:
pre_finalize()
- self.qmp_log('job-finalize', id=job)
+ if cancel:
+ self.qmp_log('job-cancel', id=job)
+ else:
+ self.qmp_log('job-finalize', id=job)
elif status == 'concluded' and not auto_dismiss:
self.qmp_log('job-dismiss', id=job)
elif status == 'null':
--
2.21.0
- Re: [Qemu-devel] [PATCH v2 09/18] block/dirty-bitmap: add bdrv_dirty_bitmap_merge_internal, (continued)
[Qemu-devel] [PATCH v2 12/18] block/backup: add 'always' bitmap sync policy, John Snow, 2019/07/03
[Qemu-devel] [PATCH v2 10/18] block/dirty-bitmap: add bdrv_dirty_bitmap_get, John Snow, 2019/07/03
[Qemu-devel] [PATCH v2 14/18] iotests: teach run_job to cancel pending jobs,
John Snow <=
[Qemu-devel] [PATCH v2 11/18] block/backup: upgrade copy_bitmap to BdrvDirtyBitmap, John Snow, 2019/07/03
[Qemu-devel] [PATCH v2 13/18] iotests: add testing shim for script-style python tests, John Snow, 2019/07/03
[Qemu-devel] [PATCH v2 15/18] iotests: teach FilePath to produce multiple paths, John Snow, 2019/07/03