[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/11] iotests: Add @use_log to VM.run_job()
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 08/11] iotests: Add @use_log to VM.run_job() |
Date: |
Mon, 15 Jul 2019 16:29:02 +0200 |
unittest-style tests generally do not use the log file, but VM.run_job()
can still be useful to them. Add a parameter to it that hides its
output from the log file.
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/iotests.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 3ecef5bc90..ce74177ab1 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -542,7 +542,7 @@ 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, use_log=True, wait=60.0):
match_device = {'data': {'device': job}}
match_id = {'data': {'id': job}}
events = [
@@ -557,7 +557,8 @@ class VM(qtest.QEMUQtestMachine):
while True:
ev = filter_qmp_event(self.events_wait(events))
if ev['event'] != 'JOB_STATUS_CHANGE':
- log(ev)
+ if use_log:
+ log(ev)
continue
status = ev['data']['status']
if status == 'aborting':
@@ -565,13 +566,20 @@ class VM(qtest.QEMUQtestMachine):
for j in result['return']:
if j['id'] == job:
error = j['error']
- log('Job failed: %s' % (j['error']))
+ if use_log:
+ log('Job failed: %s' % (j['error']))
elif status == 'pending' and not auto_finalize:
if pre_finalize:
pre_finalize()
- self.qmp_log('job-finalize', id=job)
+ if use_log:
+ self.qmp_log('job-finalize', id=job)
+ else:
+ self.qmp('job-finalize', id=job)
elif status == 'concluded' and not auto_dismiss:
- self.qmp_log('job-dismiss', id=job)
+ if use_log:
+ self.qmp_log('job-dismiss', id=job)
+ else:
+ self.qmp('job-dismiss', id=job)
elif status == 'null':
return error
--
2.21.0
- [Qemu-devel] [PULL 00/11] Block patches for rc1, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 01/11] nvme: Set number of queues later in nvme_init(), Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 02/11] block: Add BDS.never_freeze, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 03/11] block/stream: Fix error path, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 04/11] block/stream: Swap backing file change order, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 05/11] block: Deep-clear inherits_from, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 06/11] iotests: Fix throttling in 030, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 07/11] iotests: Compare error messages in 030, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 08/11] iotests: Add @use_log to VM.run_job(),
Max Reitz <=
- [Qemu-devel] [PULL 09/11] iotests: Add new case to 030, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 10/11] iotests: Add read-only test case to 030, Max Reitz, 2019/07/15
- [Qemu-devel] [PULL 11/11] gluster: fix .bdrv_reopen_prepare when backing file is a JSON object, Max Reitz, 2019/07/15
- Re: [Qemu-devel] [PULL 00/11] Block patches for rc1, Peter Maydell, 2019/07/15