diff options
| author | Damien George <damien@micropython.org> | 2022-10-14 16:10:38 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-10-14 16:10:38 +1100 |
| commit | 965a87b53cd9da32a546b03cdd01042058080498 (patch) | |
| tree | 56a33505a68bf6cc5aec45a7a1a8d0ca6c52d82b | |
| parent | 815920c87f9bda6b3fb7ec24686154210c9e8774 (diff) | |
tests/extmod: Add test for sleep_ms value that overflows ticks.
Addresses #9516.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | tests/extmod/uasyncio_micropython.py | 6 | ||||
| -rw-r--r-- | tests/extmod/uasyncio_micropython.py.exp | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/extmod/uasyncio_micropython.py b/tests/extmod/uasyncio_micropython.py index 69e5fa322..a6b65bb2a 100644 --- a/tests/extmod/uasyncio_micropython.py +++ b/tests/extmod/uasyncio_micropython.py @@ -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)) diff --git a/tests/extmod/uasyncio_micropython.py.exp b/tests/extmod/uasyncio_micropython.py.exp index f5be1dc75..4d1c6d681 100644 --- a/tests/extmod/uasyncio_micropython.py.exp +++ b/tests/extmod/uasyncio_micropython.py.exp @@ -1,4 +1,5 @@ True +OverflowError task start 1 task end 1 2 |
