pandad: test release -> devel bootstub reflash (#28330)

* test

* release bootstubs

* rm that

* fixup

* skip earlier

---------

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 28980cf4c6
beeps
Adeeb Shihadeh 2 years ago committed by GitHub
parent 2d3f8208f7
commit c9125c6a25
  1. 2
      panda
  2. BIN
      selfdrive/boardd/tests/bootstub.panda.bin
  3. BIN
      selfdrive/boardd/tests/bootstub.panda_h7.bin
  4. 31
      selfdrive/boardd/tests/test_pandad.py

@ -1 +1 @@
Subproject commit bf2c0071036bae4e0c00c37ae43237fce6063e31 Subproject commit 1a9a94c519cb74e9e0f57bea4d316a54c27ea8aa

@ -1,16 +1,19 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
import time import time
import unittest import unittest
import cereal.messaging as messaging import cereal.messaging as messaging
from cereal import log from cereal import log
from common.gpio import gpio_set, gpio_init from common.gpio import gpio_set, gpio_init
from panda import Panda from panda import Panda, PandaDFU
from selfdrive.test.helpers import phone_only from selfdrive.test.helpers import phone_only
from selfdrive.manager.process_config import managed_processes from selfdrive.manager.process_config import managed_processes
from system.hardware import HARDWARE from system.hardware import HARDWARE
from system.hardware.tici.pins import GPIO from system.hardware.tici.pins import GPIO
HERE = os.path.dirname(os.path.realpath(__file__))
class TestPandad(unittest.TestCase): class TestPandad(unittest.TestCase):
@ -27,11 +30,13 @@ class TestPandad(unittest.TestCase):
if sm['peripheralState'].pandaType == log.PandaState.PandaType.unknown: if sm['peripheralState'].pandaType == log.PandaState.PandaType.unknown:
raise Exception("boardd failed to start") raise Exception("boardd failed to start")
def _go_to_dfu(self):
HARDWARE.recover_internal_panda()
assert Panda.wait_for_dfu(None, 10)
@phone_only @phone_only
def test_in_dfu(self): def test_in_dfu(self):
HARDWARE.recover_internal_panda() HARDWARE.recover_internal_panda()
time.sleep(1)
managed_processes['pandad'].start() managed_processes['pandad'].start()
self._wait_for_boardd(60) self._wait_for_boardd(60)
@ -66,9 +71,25 @@ class TestPandad(unittest.TestCase):
managed_processes['pandad'].start() managed_processes['pandad'].start()
self._wait_for_boardd(8) self._wait_for_boardd(8)
@phone_only
def test_release_to_devel_bootstub(self):
if HARDWARE.get_device_type() != 'tici':
self.skipTest("TODO: fix reset timeout")
# flash release bootstub
self._go_to_dfu()
pd = PandaDFU(None)
fn = os.path.join(HERE, pd.get_mcu_type().config.bootstub_fn)
with open(fn, "rb") as f:
pd.program_bootstub(f.read())
pd.reset()
assert Panda.wait_for_panda(None, 20)
with Panda() as p:
assert p.bootstub
#def test_out_of_date_fw(self): managed_processes['pandad'].start()
# pass self._wait_for_boardd(60)
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save