tests/extmod: Add test for sleep_ms value that overflows ticks.

Addresses #9516.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-10-14 16:10:38 +11:00
parent 815920c87f
commit 965a87b53c
2 changed files with 7 additions and 0 deletions

View File

@ -22,6 +22,12 @@ async def main():
await uasyncio.sleep_ms(1)
print(utime.ticks_diff(utime.ticks_ms(), t0) < 100)
try:
# Sleep 1ms beyond maximum allowed sleep value
await uasyncio.sleep_ms(utime.ticks_add(0, -1) // 2 + 1)
except OverflowError:
print("OverflowError")
# When task finished before the timeout
print(await uasyncio.wait_for_ms(task(1, 5), 50))

View File

@ -1,4 +1,5 @@
True
OverflowError
task start 1
task end 1
2