Reorganized machine.Timer tests#19197
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19197 +/- ##
=======================================
Coverage 98.47% 98.47%
=======================================
Files 176 176
Lines 22831 22831
=======================================
Hits 22483 22483
Misses 348 348 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for doing this! I tested on mimxrt TEENSY40. Both Since the old (The two virtual timer tests pass on mimxrt.) |
b228cb1 to
2f1529c
Compare
|
Fixed. Previously the hardware timer test only ran on the Actually, I think that means there currently isn't a single port that supports hardware timers with a hard IRQ via |
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2f1529c to
4292aab
Compare
Summary
Split off from #19163 (comment).
This reorganizes the machine_timer tests, grouping them by virtual vs hardware and by softirq vs hardirq.
It also expands the tests in two ways:
While running the updated tests on a bunch of platforms I also found the Zephyr port can hang when repeatedly initialising a timer, presumably because we're overwriting the timer struct of a timer that's already running. The last commit fixes that, ensuring that at least the unit tests on Zephyr don't hang the board.
Testing
The updated run without errors on
esp8266,rp2,stm32ports. Theunixandnrfports also run without errors, namely by skipping all these tests because they're not supported.Two port have are broken due to not passing the tests:
esp32: Running on the original ESP32 breaks due to esp32/machine_timer: Repeatedly initialising hardware timer breaks clock. #19162.zephyr(running on a STM32WB55RG):sleep_msoften takes a bit (up to 5-7ms) longer than it should, throwing off the timing and letting an additional iteration of the timer fire off. This probably wasn't a problem when we only did a single 90ms sleep; but the updated tests split that into a four smaller sleeps, and now each of those sleeps may overshoot by this amount of time making it drift enough that the test breaks.Other ports were not tested.
Trade-offs and Alternatives
To fix the
esp32port, #19163 or any alternative fixing #19162 should be merged.To fix the
zephyrport, either the precision of the timer could be improved, or for the time being the timing requirements imposed by this test could be relaxed a bit.Generative AI
I did not use generative AI tools when creating this PR.