[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-5.2 v3 2/3] iotests.py: Add wait_for_runstate()
From: |
Max Reitz |
Subject: |
[PATCH for-5.2 v3 2/3] iotests.py: Add wait_for_runstate() |
Date: |
Wed, 22 Jul 2020 10:05:15 +0200 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/iotests.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 3590ed78a0..20645a6e7d 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -28,6 +28,7 @@ import signal
import struct
import subprocess
import sys
+import time
from typing import (Any, Callable, Dict, Iterable,
List, Optional, Sequence, Tuple, TypeVar)
import unittest
@@ -803,6 +804,10 @@ class VM(qtest.QEMUQtestMachine):
'Found node %s under %s (but expected %s)' % \
(node['name'], path, expected_node)
+ def wait_for_runstate(self, runstate: str) -> None:
+ while self.qmp('query-status')['return']['status'] != runstate:
+ time.sleep(0.2)
+
index_re = re.compile(r'([^\[]+)\[([^\]]+)\]')
class QMPTestCase(unittest.TestCase):
--
2.26.2