[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 05/15] qemu-iotests: delay QMP socket timers
From: |
Max Reitz |
Subject: |
Re: [PATCH v3 05/15] qemu-iotests: delay QMP socket timers |
Date: |
Fri, 30 Apr 2021 13:59:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 14.04.21 19:03, Emanuele Giuseppe Esposito wrote:
Attaching a gdbserver implies that the qmp socket
should wait indefinitely for an answer from QEMU.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
python/qemu/machine.py | 3 +++
tests/qemu-iotests/iotests.py | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index 12752142c9..d6142271c2 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -409,6 +409,9 @@ def _launch(self) -> None:
stderr=subprocess.STDOUT,
shell=False,
close_fds=False)
+
+ if 'gdbserver' in self._wrapper:
+ self._qmp_timer = None
Why doesn’t __init__() evaluate this? This here doesn’t feel like the
right place for it. If we want to evaluate it here, self._qmp_timer
shouldn’t exist, and instead the timeout should be a _post_launch()
parameter. (Which I would have nothing against, by the way.)
Also, mypy complains that this variable is a float, so iotest 297 (which
runs mypy) fails.
self._post_launch()
def _early_cleanup(self) -> None:
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 05d0dc0751..380527245e 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -478,7 +478,10 @@ def log(msg: Msg,
class Timeout:
def __init__(self, seconds, errmsg="Timeout"):
- self.seconds = seconds
+ if qemu_gdb:
+ self.seconds = 3000
+ else:
+ self.seconds = seconds
We might as well completely disable the timeout then, that would be more
honest, I think. (I.e. to make __enter__ and __exit__ no-ops.)
self.errmsg = errmsg
def __enter__(self):
signal.signal(signal.SIGALRM, self.timeout)
@@ -684,6 +687,11 @@ def qmp_to_opts(self, obj):
output_list += [key + '=' + obj[key]]
return ','.join(output_list)
+ def get_qmp_events(self, wait: bool = False) -> List[QMPMessage]:
+ if qemu_gdb:
+ wait = 0.0
First, this is a bool. I can see that qmp.py expects a
Union[bool, float], but machine.py expects just a bool. (Also, mypy
complains that this specific `wait` here is a `bool`. You can see that
by running iotest 297.)
Second, I don’t understand this. If the caller wants to block waiting
on an event, then that should have nothing to do with whether we have
gdb running or not. As far as I understand, setting wait to 0.0 is the
same as wait = False, i.e. we don’t block and just return None
immediately if there is no pending event.
Max
+ return super().get_qmp_events(wait=wait)
+
def get_qmp_events_filtered(self, wait=60.0):
result = []
for ev in self.get_qmp_events(wait=wait):
- [PATCH v3 02/15] python: qemu: pass the wrapper field from QEMUQtestmachine to QEMUMachine, (continued)
- [PATCH v3 02/15] python: qemu: pass the wrapper field from QEMUQtestmachine to QEMUMachine, Emanuele Giuseppe Esposito, 2021/04/14
- [PATCH v3 03/15] docs/devel/testing: add debug section to the QEMU iotests chapter, Emanuele Giuseppe Esposito, 2021/04/14
- [PATCH v3 04/15] qemu-iotests: add option to attach gdbserver, Emanuele Giuseppe Esposito, 2021/04/14
- [PATCH v3 05/15] qemu-iotests: delay QMP socket timers, Emanuele Giuseppe Esposito, 2021/04/14
- Re: [PATCH v3 05/15] qemu-iotests: delay QMP socket timers,
Max Reitz <=
- [PATCH v3 06/15] qemu_iotests: insert gdbserver command line as wrapper for qemu binary, Emanuele Giuseppe Esposito, 2021/04/14
- [PATCH v3 07/15] qemu-iotests: add gdbserver option to script tests too, Emanuele Giuseppe Esposito, 2021/04/14
- [PATCH v3 08/15] docs/devel/testing: add -gdb option to the debugging section of QEMU iotests, Emanuele Giuseppe Esposito, 2021/04/14
- [PATCH v3 09/15] qemu_iotests: extend the check script to support valgrind for python tests, Emanuele Giuseppe Esposito, 2021/04/14
- [PATCH v3 14/15] qemu_iotests: add option to show qemu binary logs on stdout, Emanuele Giuseppe Esposito, 2021/04/14