Run the full sweep test matrix on the device. Args: port: Serial port path driver: Driver name (e.g. "PARLIO", "RMT", "SPI") verbose: Enable verbose RPC output timeout: Per-test timeout in seconds Returns: List of TestResult objects
(
port: str,
driver: str,
verbose: bool = False,
timeout: float = 120.0,
)
| 173 | |
| 174 | |
| 175 | async def run_sweep( |
| 176 | port: str, |
| 177 | driver: str, |
| 178 | verbose: bool = False, |
| 179 | timeout: float = 120.0, |
| 180 | ) -> list[TestResult]: |
| 181 | """Run the full sweep test matrix on the device. |
| 182 | |
| 183 | Args: |
| 184 | port: Serial port path |
| 185 | driver: Driver name (e.g. "PARLIO", "RMT", "SPI") |
| 186 | verbose: Enable verbose RPC output |
| 187 | timeout: Per-test timeout in seconds |
| 188 | |
| 189 | Returns: |
| 190 | List of TestResult objects |
| 191 | """ |
| 192 | test_matrix = build_test_matrix(driver) |
| 193 | results: list[TestResult] = [] |
| 194 | |
| 195 | print(f"\n{'=' * 70}") |
| 196 | print(f" {driver} Sweep Test") |
| 197 | print(f" {len(test_matrix)} test configurations") |
| 198 | print(f" Port: {port}") |
| 199 | print(f"{'=' * 70}") |
| 200 | print() |
| 201 | |
| 202 | # Print test matrix |
| 203 | print("Test Matrix:") |
| 204 | print(f" {'#':<3} {'Config':<40} {'Sizes':<20} {'API':<10}") |
| 205 | print(f" {'-' * 3} {'-' * 40} {'-' * 20} {'-' * 10}") |
| 206 | for i, tc in enumerate(test_matrix, 1): |
| 207 | sizes_str = ",".join(str(s) for s in tc.lane_sizes) |
| 208 | api = "legacy" if tc.use_legacy_api else "channel" |
| 209 | print( |
| 210 | f" {i:<3} {tc.driver} {tc.lane_count}L base={tc.base_led_count:<8} [{sizes_str}]{'':<{15 - len(sizes_str)}} {api}" |
| 211 | ) |
| 212 | print() |
| 213 | |
| 214 | # Connect to device using pyserial (avoids fbuild daemon port locking issues) |
| 215 | print(f"Connecting to {port}...") |
| 216 | iface = create_serial_interface(port, use_pyserial=True) |
| 217 | client = RpcClient( |
| 218 | port, |
| 219 | timeout=timeout, |
| 220 | verbose=verbose, |
| 221 | serial_interface=iface, |
| 222 | ) |
| 223 | |
| 224 | try: |
| 225 | await client.connect(boot_wait=3.0, drain_boot=True) |
| 226 | print("Connected\n") |
| 227 | |
| 228 | # Ping to verify device is alive |
| 229 | try: |
| 230 | ping_response = await client.send("ping", timeout=10.0) |
| 231 | print(f"Device alive: {ping_response.data}") |
| 232 | except KeyboardInterrupt as ki: |
no test coverage detected