tests/multi_exmod/machine_can_05: Fix test setup race. - #19614
Conversation
Follow-up to b35383b which fixed one test setup race, but seemed to introduce failures - at least intermittently on some stm32 test configs. Guessing at a root cause: the 100ms sleep may not have been enough for the host to always coordinate instances, in which case instance1 might start sending onto the bus before instance0. Fix is to add an explicit synchronisation point so instance1 doesn't try to send until after instance0 has definitely started "babbling". This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19614 +/- ##
==========================================
- Coverage 98.59% 98.56% -0.04%
==========================================
Files 182 182
Lines 23320 23320
Branches 5 5
==========================================
- Hits 22992 22985 -7
- Misses 327 334 +7
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for looking in to this. Testing on PYBV10 <-> PYBV10:
Agreed, but I think the fix here is good:
So I think this we should merge this, although would be good if @robert-hh could test it to make sure it doesn't regress his set up. |
|
Actually it seems that with the alif board as instance 0 and the Teensy as instance 1 the fail rate is the same, 8 in 1000 vs. 8 in 1000 before. But the fail pattern may be different. I'll re-test with the previous version. Edit: The fail pattern is the same: Some low prio message manage to sneak in, at least with the Teensy as instance 1. |
|
Other combinations: PYBV11 and Alif AE3: 11 fails of 1000 attempts, Alif at instance 0 So it looks like this change is good, and the behavior with the Alif port is independent. |
robert-hh
left a comment
There was a problem hiding this comment.
Works fine. No regression. Test with PYBV11 and Teensys passes without fail. No increase in the fail rate with Alif AE3 and Teensy/PYBV11.
|
|
||
|
|
||
| def irq_recv(can): | ||
| global recv_std_id |
There was a problem hiding this comment.
This symbol is not used.
Summary
This is an attempt to fix the problem described by Damien in this PR comment. It is a follow-up to b35383b which fixed one test setup race, but seemed to introduce failures - at least on some stm32 test configs.
Guessing at a root cause: the 100ms sleep may not have been enough for the host to always coordinate instances, in which case instance1 might start sending onto the bus before instance0. Fix is to add an explicit synchronisation point so instance1 doesn't try to send until after instance0 has definitely started "babbling".
This work was funded through GitHub Sponsors.
Testing
machine_can_05_tx_prio_cancel.pywould fail with similar output to @dpgeorge's report in the linked comment. Suspect host timing may be the reason why Damien sees this every time and I only see it occasionally.-p2) with no failures.Trade-offs and Alternatives
Generative AI
I did not use generative AI tools when creating this PR.