tests/ports/rp2: Convert rp2.DMA test to a unittest and make it more reliable #17202
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR converts the rp2.DMA test to a unittest (in the first commit, should be a no-op in terms of functionality of the test) and makes it more reliable across all platforms (in the second commit).
Changes to the test to make it more reliable are:
dma.active
.range(30, 80)
to cover RP2040, RP2350, RISC-V variants, and both bytecode and native emitter.sleep_ms(1)
after waiting for the IRQ to fire, so that any scheduled code gets a chance to run when the test is compiled with the native emitter.Testing
With these changes this test passes reliably on RPI_PICO, RPI_PICO_W, RPI_PICO2, RPI_PICO2_W, RPI_PICO2-RISCV and RPI_PICO2_W-RISCV, in both bytecode and native emitter mode, with and without WLAN enabled.
The changes here picked up the bug fixed by #17201.