process replay: fix output after timeout added (#1020)

* process replay: fix output after timeout added

* better error
pull/1024/head
Adeeb 6 years ago committed by GitHub
parent 8507e683ae
commit 44e97ead7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      selfdrive/test/process_replay/process_replay.py

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import sys
import threading import threading
import importlib import importlib
import shutil import shutil
@ -21,7 +22,12 @@ ProcessConfig = namedtuple('ProcessConfig', ['proc_name', 'pub_sub', 'ignore', '
def wait_for_event(evt): def wait_for_event(evt):
if not evt.wait(15): if not evt.wait(15):
raise Exception("Timeout reached. Thread likely crashed.") if threading.currentThread().getName() == "MainThread":
# tested process likely died. don't let test just hang
raise Exception("Timeout reached. Tested process likely crashed.")
else:
# done testing this process, let it die
sys.exit(0)
class FakeSocket: class FakeSocket:
def __init__(self, wait=True): def __init__(self, wait=True):

Loading…
Cancel
Save