Add goTool autotest with bench configs and UART scenarios.

JSON configs describe network and node MACs; scenarios run command
sequences with expect checks. Share UART client API across CLI and tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-18 23:36:28 +02:00
co-authored by Cursor
parent a8ae65d9dc
commit d24b0cb5c3
17 changed files with 958 additions and 106 deletions
+47
View File
@@ -0,0 +1,47 @@
# goTool autotest fixtures
## Bench config (`configs/*.json`)
Describes your hardware bench (for documentation and slave lookup in tests).
| Field | Meaning |
|-------|---------|
| `id` | Config name; referenced by scenarios |
| `network` | ESP-NOW network **18** (must match DIP/IO expander on all nodes) |
| `master_mac` | Expected WiFi MAC of the master ESP (reference) |
| `slaves[].id` | Short name used in scenario `input.slave` / `expect.slave` |
| `slaves[].mac` | Full slave STA MAC (must match `gotool clients`) |
| `slaves[].client_id` | Optional; default = last MAC byte |
Copy `example-lab.json` to e.g. `my-lab.json` and set real MACs.
## Scenario (`scenarios/*.json`)
Ordered steps: UART commands with `input` and `expect`.
| Step field | Meaning |
|------------|---------|
| `delay_ms` | Sleep only (no command) |
| `command` | `version`, `clients`, `deadzone`, `unicast_test` |
| `input` | Command arguments (see below) |
| `expect` | Assertions on the response |
### 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`
### Example
```bash
cd goTool
go run . -port /dev/ttyUSB0 test -config my-lab -scenario smoke
go run . -port /dev/ttyUSB0 test -list-configs
```