"""Run a known UART vector through the real ARM DSView worker (on the board).""" from pathlib import Path import subprocess import struct import sys import tempfile worker = Path(sys.argv[1]).resolve() decoders = sys.argv[2] with tempfile.TemporaryDirectory(prefix='scope-worker-test-') as temp: root = Path(temp) samples = bytearray([1]*32) for value in (0x55, 0x41, 0xA3): for bit in [0]+[(value>>i)&1 for i in range(8)]+[1, 1]: samples.extend([bit]*16) samples.extend([1]*64) snapshot = root/'uart.bin' snapshot.write_bytes(b'LDS1'+struct.pack('=6 and r[0]=='A' and r[4]=='RX/TX'] assert [r[5] for r in data] == ['0x55', '0x41', '0xA3'], data assert [int(r[1]) for r in data] == [32, 208, 384], data print('PASS ARM worker: DSView 0:UART and 1:UART, 55 41 A3, exact sample timestamps')