Skip to content

Commit

Permalink
tests : does not make the test fail if we cannot stop correctly the g…
Browse files Browse the repository at this point in the history
…uest
  • Loading branch information
hector-cao committed Nov 18, 2024
1 parent 85abcfa commit 406f3c7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/lib/Qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 406f3c7

Please sign in to comment.