qemu-iotests: delay QMP socket timers

Attaching gdbserver implies that the qmp socket
should wait indefinitely for an answer from QEMU.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210809090114.64834-7-eesposit@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
This commit is contained in:
Emanuele Giuseppe Esposito 2021-08-09 11:01:04 +02:00 committed by Hanna Reitz
parent cfb9b0b731
commit d3ec2022cb

View File

@ -477,10 +477,14 @@ class Timeout:
self.seconds = seconds
self.errmsg = errmsg
def __enter__(self):
if qemu_gdb:
return self
signal.signal(signal.SIGALRM, self.timeout)
signal.setitimer(signal.ITIMER_REAL, self.seconds)
return self
def __exit__(self, exc_type, value, traceback):
if qemu_gdb:
return False
signal.setitimer(signal.ITIMER_REAL, 0)
return False
def timeout(self, signum, frame):
@ -575,7 +579,7 @@ class VM(qtest.QEMUQtestMachine):
def __init__(self, path_suffix=''):
name = "qemu%s-%d" % (path_suffix, os.getpid())
timer = 15.0
timer = 15.0 if not qemu_gdb else None
super().__init__(qemu_prog, qemu_opts, name=name,
base_temp_dir=test_dir,
socket_scm_helper=socket_scm_helper,