From 577dc95d444d77fd733b6fba3be0140a4ad884af Mon Sep 17 00:00:00 2001 From: Dom <168790843+firestar5683@users.noreply.github.com> Date: Sun, 15 Nov 2026 06:14:12 -0600 Subject: [PATCH] Exercise PQ native callers in instrumented safety coverage --- openpilot/starpilot/aol/tests/test_pq_aol.py | 38 ++++++++++++++++++++ prebuilt.json | 2 +- tools/ci/safety_pytest_coverage.py | 3 +- tools/ci/tests/test_safety_qualification.py | 3 +- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/openpilot/starpilot/aol/tests/test_pq_aol.py b/openpilot/starpilot/aol/tests/test_pq_aol.py index e9e275bd3d..3ddbdaf45f 100644 --- a/openpilot/starpilot/aol/tests/test_pq_aol.py +++ b/openpilot/starpilot/aol/tests/test_pq_aol.py @@ -251,3 +251,41 @@ def test_brake_held_standstill_set_waits_for_release_and_new_brake_withdraws_lon assert n.feed(speed=0) == 2 assert n.feed(speed=0, brake=True) == 0 assert n.feed(speed=0) == 0 + + +def test_zero_host_request_releases_both_accepted_forwarding_leases(): + n = Native() + assert n.prime() == 1 + assert n.s.safety_tx_hook(n.steer()) + assert n.s.safety_tx_hook(n.msg('LDW_Status')) + assert n.s.safety_fwd_hook(2, 0xD2) == -1 + assert n.s.safety_fwd_hook(2, 0x5BE) == -1 + n.s.aol_set_host_request(0) + assert n.s.aol_get_permission_mask() == 0 + assert n.s.safety_fwd_hook(2, 0xD2) == 0 + assert n.s.safety_fwd_hook(2, 0x5BE) == 0 + assert not n.s.safety_tx_hook(n.steer()) + + +def test_permanent_eps_fault_needs_fresh_stock_cruise_edge(): + n = Native() + assert n.prime() == 1 + assert n.feed(eps=2) == 0 + assert n.feed() == 0 + assert n.feed(cruise=True) == 1 + assert not n.s.safety_tx_hook(n.msg('ACC_System', {'ACS_Sollbeschl': 0.5})) + + +def test_neutral_main_without_heartbeat_expires_without_latent_grant(): + n = Native() + n.s.set_aol_test_heartbeat(False) + assert n.prime() == 0 + assert n.feed(main=False) == 0 + for _ in range(31): + assert n.feed() == 0 + assert not n.s.safety_tx_hook(n.steer()) + n.s.set_aol_test_heartbeat(True) + assert n.feed() == 0 + assert not n.s.safety_tx_hook(n.steer()) + assert n.feed(main=False) == 0 + assert n.feed() == 1 diff --git a/prebuilt.json b/prebuilt.json index 7c20f2e108..a0818bbaae 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "eeab4a5014c1099cb9bc29dd38816409503c6d37125ca179c5f5ae811f8ac4d8", "schema_version": 1} +{"protected_inventory_sha256": "22d9ebd9b5c80f58f463761df0a07d8b087ee96879b8fc2e6d9e20a5bd675325", "schema_version": 1} diff --git a/tools/ci/safety_pytest_coverage.py b/tools/ci/safety_pytest_coverage.py index 60cf6914d7..c80c379e8d 100644 --- a/tools/ci/safety_pytest_coverage.py +++ b/tools/ci/safety_pytest_coverage.py @@ -32,7 +32,8 @@ def targets_for_coverage(root=ROOT): # These existing end-to-end callers bind the supplied library. Other vehicle suites # deliberately compile distinct DEBUG/RELEASE artifacts and retain their own gates. for relative in ('openpilot/starpilot/car/nissan/tests/test_aol.py', - 'openpilot/starpilot/car/rivian/tests/test_aol_native.py'): + 'openpilot/starpilot/car/rivian/tests/test_aol_native.py', + 'openpilot/starpilot/aol/tests/test_pq_aol.py'): if (root / relative).is_file(): selected.add(relative) return sorted(selected - RELEASE_ONLY) diff --git a/tools/ci/tests/test_safety_qualification.py b/tools/ci/tests/test_safety_qualification.py index 59a55ee1a0..458a061ef5 100644 --- a/tools/ci/tests/test_safety_qualification.py +++ b/tools/ci/tests/test_safety_qualification.py @@ -97,7 +97,8 @@ class TestSafetyQualificationRunner(TestCase): selected = coverage.targets_for_coverage(qualification.ROOT) for name in ('opendbc_repo/opendbc/safety/tests/test_tesla_preap_pedal.py::test_actual_registered_priming_rate_absolute_bus_and_counter_bounds', 'openpilot/starpilot/car/nissan/tests/test_aol.py', - 'openpilot/starpilot/car/rivian/tests/test_aol_native.py'): + 'openpilot/starpilot/car/rivian/tests/test_aol_native.py', + 'openpilot/starpilot/aol/tests/test_pq_aol.py'): self.assertIn(name, selected) import ast plan = ast.parse((qualification.ROOT / 'tools/ci/run_vehicle_tests.py').read_text())