From 8a845b973ea9fbe5daa09ef92dfc8938a4fbe789 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 21 Mar 2024 20:28:44 -0700 Subject: [PATCH] boot time test (#1909) * test * usb serial * just test for now * time * close * close after --- Jenkinsfile | 2 +- python/__init__.py | 2 ++ tests/hitl/8_misc.py | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/hitl/8_misc.py diff --git a/Jenkinsfile b/Jenkinsfile index 25b8490a..23a249b3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,7 +82,7 @@ pipeline { ["build", "scons -j4"], ["flash", "cd tests/ && ./reflash_internal_panda.py"], ["flash jungle", "cd board/jungle && ./flash.py"], - ["test", "cd tests/hitl && HW_TYPES=6 pytest -n0 --durations=0 [2-7]*.py -k 'not test_send_recv'"], + ["test", "cd tests/hitl && HW_TYPES=6 pytest -n0 --durations=0 [2-9]*.py -k 'not test_send_recv'"], ]) } } diff --git a/python/__init__.py b/python/__init__.py index c2bfa5a0..f97f608a 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -433,6 +433,8 @@ class Panda: self._handle.controlWrite(Panda.REQUEST_IN, 0xd8, 0, 0, b'', timeout=timeout, expect_disconnect=True) except Exception: pass + + self.close() if not enter_bootloader and reconnect: self.reconnect() diff --git a/tests/hitl/8_misc.py b/tests/hitl/8_misc.py new file mode 100644 index 00000000..63e1c3e8 --- /dev/null +++ b/tests/hitl/8_misc.py @@ -0,0 +1,10 @@ +import time + +from panda import Panda + +def test_boot_time(p): + # boot time should be instant + st = time.monotonic() + p.reset(reconnect=False) + assert Panda.wait_for_panda(p.get_usb_serial(), timeout=3.0) + assert time.monotonic() - st < 3.0