mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-13 08:50:56 +00:00
python: kill emulator if it doesn't become ready in time
this fixes a problem in upgrade-test, when one emulator fails to come up and then blocks all other tests. the CI task will still be failed, but at least we'll know at a glance that it is a timeout problem
This commit is contained in:
parent
72537e3c3a
commit
0a052806c7
@ -97,7 +97,7 @@ class Emulator:
|
||||
|
||||
elapsed = time.monotonic() - start
|
||||
if elapsed >= timeout:
|
||||
raise RuntimeError("Can't connect to emulator")
|
||||
raise TimeoutError("Can't connect to emulator")
|
||||
|
||||
time.sleep(0.1)
|
||||
finally:
|
||||
@ -135,7 +135,12 @@ class Emulator:
|
||||
return
|
||||
|
||||
self.process = self.launch_process()
|
||||
self.wait_until_ready()
|
||||
try:
|
||||
self.wait_until_ready()
|
||||
except TimeoutError:
|
||||
# Assuming that after the default 30-second timeout, the process is stuck
|
||||
self.process.kill()
|
||||
raise
|
||||
|
||||
(self.profile_dir / "trezor.pid").write_text(str(self.process.pid) + "\n")
|
||||
(self.profile_dir / "trezor.port").write_text(str(self.port) + "\n")
|
||||
|
Loading…
Reference in New Issue
Block a user