diff options
| author | Zixun LI <[email protected]> | 2026-01-14 09:51:50 +0100 |
|---|---|---|
| committer | Zixun LI <[email protected]> | 2026-01-14 09:51:50 +0100 |
| commit | 796e7c23320f6fb48007e8b773841784f420b577 (patch) | |
| tree | 1647c7967a377d8021510033602b61fefe22bb50 /test | |
| parent | 7a4e3d0821fb7913fbcca55018b41e66a6339df6 (diff) | |
| parent | 5e6e9e6ad0cf7b49b3ed3b6d18c20be57afeef06 (diff) | |
Merge remote-tracking branch 'tinyusb/master' into bsp_h7_tm4c
Diffstat (limited to 'test')
| -rwxr-xr-x | test/hil/hil_test.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index b2e883119..b84740867 100755 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -151,7 +151,7 @@ def read_disk_file(uid, lun, fname): def open_mtp_dev(uid): mtp = MTP() # MTP seems to take a while to enumerate - timeout = 2*ENUM_TIMEOUT + timeout = 2 * ENUM_TIMEOUT while timeout > 0: # run_cmd(f"gio mount -u mtp://TinyUsb_TinyUsb_Device_{uid}/") for raw in mtp.detect_devices(): @@ -410,22 +410,22 @@ def test_device_cdc_dual_ports(board): sizes = [32, 64, 128, 256, 512, random.randint(2000, 5000)] def write_and_check(writer, payload): - size = len(payload) + payload_len = len(payload) for s in ser: s.reset_input_buffer() rd0 = b'' rd1 = b'' offset = 0 # Write in chunks of random 1-64 bytes (device has 64-byte buffer) - while offset < size: - chunk_size = min(random.randint(1, 64), size - offset) + while offset < payload_len: + chunk_size = min(random.randint(1, 64), payload_len - offset) ser[writer].write(payload[offset:offset + chunk_size]) ser[writer].flush() rd0 += ser[0].read(chunk_size) rd1 += ser[1].read(chunk_size) offset += chunk_size - assert rd0 == payload.lower(), f'Port0 wrong data ({size}): expected {payload.lower()[:16]}... was {rd0[:16]}' - assert rd1 == payload.upper(), f'Port1 wrong data ({size}): expected {payload.upper()[:16]}... was {rd1[:16]}' + assert rd0 == payload.lower(), f'Port0 wrong data ({payload_len}): expected {payload.lower()}... was {rd0}' + assert rd1 == payload.upper(), f'Port1 wrong data ({payload_len}): expected {payload.upper()}... was {rd1}' for size in sizes: payload0 = rand_ascii(size) |
