-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only run tx hooks on msgs in safety_config.tx_msgs. #1851
base: master
Are you sure you want to change the base?
Conversation
3fba360
to
447a45f
Compare
safety tests are failing |
Are our tests wrong? |
tests are complaining about coverage for lines that no longer get hit. also i got stuck in a bad state last night that was only recoverable by clearing scons cache. ugh |
@sshane nooutput tx hook will never get exercised after this change. i'm going to exclude the line from coverage and misra and document it (though technically the misra checker didn't catch it anyway). if that's not acceptable for misra, let me know if there's an approach you'd generally take for this kind of thing. (i could always concoct a "test" to exercise that line but that seems convoluted.) also, just to check, does |
This comment was marked as outdated.
This comment was marked as outdated.
Just want to call out that it's certainly possible that some car models rely on the existing bad behavior. What's your rollout policy for potentially breaking changes?
|
Just to be clear, I believe making it larger is the right thing to do based on my principles as follow. Please let me know if you require something different: i'm not backfilling existing missing tests (in hyundai_canfd) (since they're already missing so this strictly improves the codebase regardless). i am adding a test for the behavior this modifies (since not doing so strictly worsens the codebase by making bugs like this possible). |
TIL the coverage report uses a different tool (lcov) than the coverage test (gcov). gcov doesn't support exclusion markers easily. gcovr does. will send a separate PR to add support for exclusion from gcov. |
safety tests pass with #1867. will figure out some decent way of testing this behavior next |
@@ -198,9 +198,12 @@ static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) { | |||
violation |= longitudinal_accel_checks(desired_accel_val, HYUNDAI_LONG_LIMITS); | |||
} else { | |||
// only used to cancel on here | |||
// GCOV_EXCL_START | |||
// TODO: Cover this with tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure our test isn't accidentally sending this on the wrong bus? We should definitely hit this
int raw_accel = ((GET_BYTE(to_send, 2) << 3) | (GET_BYTE(to_send, 3) >> 5)) - 1024U; | ||
if (longitudinal_accel_checks(raw_accel, RIVIAN_LONG_LIMITS)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this because 0x160 is now blocked since it's not in the tx messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct. the case where addr == 0x160 && !rivian_longitudinal becomes unreachable with this change.
#1838
Dependencies: #1867
TODO: