diff options
| author | Angus Gratton <angus@redyak.com.au> | 2025-11-05 15:41:35 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-11-06 12:26:43 +1100 |
| commit | 2762fe680a03706d3c21efe51db9b1f8d193d2d0 (patch) | |
| tree | 8ac2902a1cf941a040f464f7979eed2e8a534d38 | |
| parent | 10b7dfd9f20f58987da511d87684662d3a38ef01 (diff) | |
tests/serial_test.py: Allow up to 2 seconds between bytes.HEADorigin/masterorigin/HEADmaster
Only a problem when UART TX is also enabled and goes first (i.e. esp32
port) as sending 16384 bytes in one go triggers the timeout.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
| -rwxr-xr-x | tests/serial_test.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/serial_test.py b/tests/serial_test.py index 1baa2282a..455d2277f 100755 --- a/tests/serial_test.py +++ b/tests/serial_test.py @@ -103,6 +103,11 @@ def read_test(ser_repl, ser_data, bufsize, nbuf): assert bufsize % 256 == 0 # for verify to work + # how long to wait for data from device + # (if UART TX is also enabled then it can take 1.4s to send + # out a 16KB butter at 115200bps) + READ_TIMEOUT_S = 2 + # Load and run the read_test_script. ser_repl.write(b"\x03\x01\x04") # break, raw-repl, soft-reboot drain_input(ser_repl) @@ -121,7 +126,7 @@ def read_test(ser_repl, ser_data, bufsize, nbuf): while remain: t0 = time.monotonic_ns() while ser_data.inWaiting() == 0: - if time.monotonic_ns() - t0 > 1e9: + if time.monotonic_ns() - t0 > READ_TIMEOUT_S * 1e9: # timeout waiting for data from device break time.sleep(0.0001) |
