[Spice-devel] [spice/tests/migrate v1 3/4] tests: migrate: simplify wait_active()
Victor Toso
victortoso at redhat.com
Thu Oct 3 10:14:22 UTC 2019
From: Victor Toso <me at victortoso.com>
We are only interested in the running state of qmp (or VCPUS) here
which is what we check. Moving this check to the try branch allows
removing some extra checks.
Signed-off-by: Victor Toso <victortoso at redhat.com>
---
tests/migrate.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/tests/migrate.py b/tests/migrate.py
index 88e17691..9afeb59c 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -110,20 +110,16 @@ def start_client(client, spice_port):
return Popen(client_cmd.split(), executable=client)
def wait_active(q, active):
- events = ["RESUME"] if active else ["STOP"]
while True:
try:
ret = q.cmd("query-status")
+ if ret["return"]["running"] == active:
+ break
except:
# ValueError
time.sleep(0.1)
continue
- if ret and ret.has_key("return"):
- if ret["return"]["running"] == active:
- break
- for e in q.get_events():
- if e["event"] in events:
- break
+
time.sleep(0.5)
def wait_for_event(q, event):
--
2.21.0
More information about the Spice-devel
mailing list