Skip to content

Conversation

@mpurnell1
Copy link
Contributor

@mpurnell1 mpurnell1 commented Dec 18, 2025

Description

This makes incremental progress towards #2944. In this parent PR, I create 6 helper functions in C to directly call rx hooks, bypassing the whitelists which would usually prevent these invalid calls from going through. The helper functions are then used to thoroughly test rx and tx hooks in various modes. These changes were made after discussing my previous attempt at improving branch coverage with Adeeb in the dev call. After some deliberation, I found that it is simpler to test the empty else branches than to try to remove them cleanly. If all the related PRs are merged, this PR should have no diff and could be closed.

These changes have all been broken out into individual PRs by mode:

Verification

opendbc/safety/tests/test.sh --report (with branch coverage enabled) on master:
image
Overall branch coverage: 92.2%

opendbc/safety/tests/test.sh --report on this branch:
image
Overall branch coverage: 95.6%

@github-actions github-actions bot added the car safety vehicle-specific safety code label Dec 18, 2025
@mpurnell1 mpurnell1 force-pushed the phase-out-dead-else-branches branch 2 times, most recently from f3c7e66 to 16822d3 Compare December 18, 2025 08:36
@mpurnell1 mpurnell1 marked this pull request as ready for review December 18, 2025 08:37
@mpurnell1 mpurnell1 marked this pull request as draft December 18, 2025 09:40
@mpurnell1 mpurnell1 force-pushed the phase-out-dead-else-branches branch from 914372b to 6cd9d40 Compare December 18, 2025 10:55
- Add and update `test_fuzz_hooks` across relevant modes to ensure complete coverage of safety hook logic.
- Iterate through specific message IDs, safety parameters (e.g., EV/Hybrid flags), and all CAN buses (0-2) to explicitly cover all branches of `if-else` ID and bus checks.
- Verify default/else branches by fuzzing unknown addresses.
@mpurnell1 mpurnell1 force-pushed the phase-out-dead-else-branches branch from 6cd9d40 to 776a4c4 Compare December 18, 2025 11:02
@mpurnell1 mpurnell1 marked this pull request as ready for review December 18, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

car safety vehicle-specific safety code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant