simon 0299ba44fd Add bench UART ports and cold-start reset to goTool autotest.
Bench configs define command and console serial paths; scenarios can
reset nodes via esptool before tests. Smoke resets all nodes then waits
for ESP-NOW join.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 23:44:58 +02:00

69 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# goTool autotest fixtures
## Bench config (`configs/*.json`)
Describes your hardware bench: network, MACs, and serial ports.
| Field | Meaning |
|-------|---------|
| `id` | Config name; referenced by scenarios |
| `network` | ESP-NOW network **18** (DIP / IO expander on all nodes) |
| `master_mac` | Master WiFi STA MAC (reference) |
| `uart.baud` | Command UART baud (default **921600**) |
| `uart.master` | **gotool** port — external UART adapter on master GPIO2/3 (e.g. `/dev/ttyUSB0`) |
| `uart.master_console` | Master USB-JTAG/console for **reset** via esptool (e.g. `/dev/ttyACM0`) |
| `slaves[].id` | Short name for scenarios (`input.slave`, `expect.slave`) |
| `slaves[].mac` | Slave STA MAC (must match `gotool clients`) |
| `slaves[].client_id` | Optional; default = last MAC byte |
| `slaves[].console` | Slave USB console for **reset** (optional, e.g. `/dev/ttyACM1`) |
Copy `example-lab.json``my-lab.json` and set real paths (`ls /dev/ttyUSB* /dev/ttyACM*`).
`gotool test` uses `uart.master` when `-port` is omitted. Override with `-port /dev/…`.
## Scenario (`scenarios/*.json`)
Ordered steps: UART commands, delays, or esptool reset.
| Step field | Meaning |
|------------|---------|
| `delay_ms` | Sleep only (no command) |
| `command` | See below |
| `input` | Command arguments |
| `expect` | Assertions (UART commands only) |
### Commands
**version**`expect`: `version`, `version_min`, `git_hash`
**clients**`expect`: `min_clients`, `max_clients`, `client_count`, `slave` / `slaves`, `available`
**deadzone**`input`: `write`, `value`/`deadzone`, `slave` or `client`/`client_id`, `all_clients`
`expect`: `deadzone`, `success`, `slaves_updated`, `slaves_updated_min`
**unicast_test**`input`: `slave` or `client_id`, `seq`
`expect`: `success`, `seq`
**reset** — esptool hard-reset via console port from bench config (no `expect`).
`input`: `target` (`master`) or `slave` (`pod-1`), or `all: true`; optional `wait_ms` after each reset (default 2000).
Example reset steps:
```json
{ "name": "reset master", "command": "reset", "input": { "target": "master", "wait_ms": 3000 } },
{ "name": "reset all", "command": "reset", "input": { "all": true, "wait_ms": 2500 } }
```
Requires `python -m esptool` or `esptool.py` on PATH (ESP-IDF).
The `smoke` scenario resets every node with a configured `console` port, waits **10 s** for boot and ESP-NOW join, then runs the UART checks.
### Example
```bash
cd goTool
go run . test -config example-lab -scenario smoke
go run . test -config my-lab -scenario smoke -port /dev/ttyUSB1
go run . test -list-configs
```