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:
parent
815920c87f
commit
965a87b53c
@ -22,6 +22,12 @@ async def main():
|
|||||||
await uasyncio.sleep_ms(1)
|
await uasyncio.sleep_ms(1)
|
||||||
print(utime.ticks_diff(utime.ticks_ms(), t0) < 100)
|
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
|
# When task finished before the timeout
|
||||||
print(await uasyncio.wait_for_ms(task(1, 5), 50))
|
print(await uasyncio.wait_for_ms(task(1, 5), 50))
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
True
|
True
|
||||||
|
OverflowError
|
||||||
task start 1
|
task start 1
|
||||||
task end 1
|
task end 1
|
||||||
2
|
2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user