mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 17:23:52 +08:00
CI: make bootkick test robust to health struct changes (#1711)
* CI: make bootkick test robust to health struct changes * comment * panda
This commit is contained in:
@@ -16,8 +16,9 @@ if __name__ == "__main__":
|
||||
flag_set = True
|
||||
|
||||
# shutdown when told
|
||||
if p.health()['safety_mode'] == Panda.SAFETY_SILENT:
|
||||
dt = p.get_datetime()
|
||||
if dt.year == 2040 and dt.month == 8:
|
||||
os.system("sudo poweroff")
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
time.sleep(0.5)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import time
|
||||
import pytest
|
||||
import datetime
|
||||
|
||||
from panda import Panda, PandaJungle
|
||||
|
||||
@@ -23,6 +24,8 @@ def pj():
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def p(pj):
|
||||
# note that the 3X's panda lib isn't updated, which
|
||||
# shold be fine since it only uses stable APIs
|
||||
pj.set_panda_power(True)
|
||||
assert Panda.wait_for_panda(PANDA_SERIAL, 10)
|
||||
p = Panda(PANDA_SERIAL)
|
||||
@@ -46,7 +49,7 @@ def setup_state(panda, jungle, state):
|
||||
wait_for_full_poweroff(jungle)
|
||||
jungle.set_panda_individual_power(OBDC_PORT, 1)
|
||||
wait_for_boot(panda, jungle)
|
||||
panda.set_safety_mode(Panda.SAFETY_SILENT)
|
||||
set_som_shutdown_flag(panda)
|
||||
panda.send_heartbeat()
|
||||
wait_for_som_shutdown(panda, jungle)
|
||||
else:
|
||||
@@ -78,6 +81,9 @@ def check_som_boot_flag(panda):
|
||||
h = panda.health()
|
||||
return h['safety_mode'] == Panda.SAFETY_ELM327 and h['safety_param'] == 30
|
||||
|
||||
def set_som_shutdown_flag(panda):
|
||||
panda.set_datetime(datetime.datetime(year=2040, month=8, day=23))
|
||||
|
||||
def wait_for_boot(panda, jungle, bootkick=False, timeout=120):
|
||||
st = time.monotonic()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user