]> Git Repo - qemu.git/commitdiff
iotests: improve pause_job
authorVladimir Sementsov-Ogievskiy <[email protected]>
Fri, 1 Jun 2018 11:59:23 +0000 (14:59 +0300)
committerMax Reitz <[email protected]>
Mon, 11 Jun 2018 14:18:45 +0000 (16:18 +0200)
It's possible, that job was finished during waiting. In this case we
will see error message "Timeout waiting for job to pause" which is not
very informative. So, let's check during waiting iteration that the job
exists.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-id: 20180601115923[email protected]
Signed-off-by: Max Reitz <[email protected]>
tests/qemu-iotests/iotests.py

index 0b204dc220af9489242ed66196ef308de7051ee6..2f22fab2a78162bbad92f104c0515c76a552977a 100644 (file)
@@ -590,9 +590,14 @@ class QMPTestCase(unittest.TestCase):
         with Timeout(1, "Timeout waiting for job to pause"):
             while True:
                 result = self.vm.qmp('query-block-jobs')
+                found = False
                 for job in result['return']:
-                    if job['device'] == job_id and job['paused'] == True and job['busy'] == False:
-                        return job
+                    if job['device'] == job_id:
+                        found = True
+                        if job['paused'] == True and job['busy'] == False:
+                            return job
+                        break
+                assert found
 
     def pause_job(self, job_id='job0', wait=True):
         result = self.vm.qmp('block-job-pause', device=job_id)
This page took 0.027418 seconds and 4 git commands to generate.