test_time_to_onroad: log events after onroad/timeout (#31359)

* log events

* only on fail
old-commit-hash: 4fea2a343a
chrysler-long2
Justin Newberry 1 year ago committed by GitHub
parent 261ee6d7fd
commit 43368e1313
  1. 15
      selfdrive/test/test_time_to_onroad.py

@ -21,12 +21,15 @@ def test_time_to_onroad():
sm = messaging.SubMaster(['controlsState', 'deviceState', 'onroadEvents']) sm = messaging.SubMaster(['controlsState', 'deviceState', 'onroadEvents'])
try: try:
# wait for onroad # wait for onroad
with Timeout(20, "timed out waiting to go onroad"): try:
while True: with Timeout(20, "timed out waiting to go onroad"):
sm.update(1000) while True:
if sm['deviceState'].started: sm.update(1000)
break if sm['deviceState'].started:
time.sleep(1) break
time.sleep(1)
finally:
print(f"onroad events: {sm['onroadEvents']}")
# wait for engageability # wait for engageability
with Timeout(10, "timed out waiting for engageable"): with Timeout(10, "timed out waiting for engageable"):

Loading…
Cancel
Save