From 406f3c72b1966114b7bbae1f35455ec613badd56 Mon Sep 17 00:00:00 2001 From: Hector Cao Date: Mon, 18 Nov 2024 09:20:11 +0000 Subject: [PATCH] tests : does not make the test fail if we cannot stop correctly the guest --- tests/lib/Qemu.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/lib/Qemu.py b/tests/lib/Qemu.py index faec65f..a8786ed 100644 --- a/tests/lib/Qemu.py +++ b/tests/lib/Qemu.py @@ -318,10 +318,10 @@ def __init__(self, qemu): break except Exception as e: # give some time to make sure socket file is available - print(f'Try to connect to qemu : {qemu.qcmd.monitor_file} : {e}') time.sleep(1) self.socket.settimeout(self.READ_TIMEOUT) # wait for promt + print(f'Connected : {qemu.qcmd.monitor_file}, wait for prompt.') self.wait_prompt() def recv_data(self): @@ -649,11 +649,13 @@ def stop(self): # self.proc.returncode == None -> not yet terminated - # try to shutdown the VM properly, this is important to avoid - # rootfs corruption if we want to run the guest again - mon = QemuMonitor(self) - mon.powerdown() try: + # try to shutdown the VM properly, this is important to avoid + # rootfs corruption if we want to run the guest again + # catch exception and ignore it since we are stopping .... no need to fail the test + mon = QemuMonitor(self) + mon.powerdown() + self.communicate() return except Exception as e: