CI tests: check app against known good bootstub first (#1033)

* test

* add master bootstub
This commit is contained in:
Igor Biletskyy
2022-08-15 20:11:49 -07:00
committed by GitHub
parent 54eb42d903
commit ba90f6a8c9
5 changed files with 51 additions and 19 deletions

View File

@@ -364,18 +364,16 @@ class Panda:
self.reconnect()
def recover(self, timeout: Optional[int] = None, reset: bool = True) -> bool:
dfu_serial = PandaDFU.st_serial_to_dfu_serial(self._serial, self._mcu_type)
if reset:
self.reset(enter_bootstub=True)
self.reset(enter_bootloader=True)
t_start = time.time()
while len(PandaDFU.list()) == 0:
print("waiting for DFU...")
time.sleep(0.1)
if timeout is not None and (time.time() - t_start) > timeout:
return False
if not self.wait_for_dfu(dfu_serial, timeout=timeout):
return False
dfu = PandaDFU(PandaDFU.st_serial_to_dfu_serial(self._serial, self._mcu_type))
dfu = PandaDFU(dfu_serial)
dfu.recover()
# reflash after recover
@@ -383,6 +381,16 @@ class Panda:
self.flash()
return True
@staticmethod
def wait_for_dfu(dfu_serial: str, timeout: Optional[int] = None) -> bool:
t_start = time.monotonic()
while dfu_serial not in PandaDFU.list():
print("waiting for DFU...")
time.sleep(0.1)
if timeout is not None and (time.monotonic() - t_start) > timeout:
return False
return True
@staticmethod
def list():
context = usb1.USBContext()