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
```
+13
View File
@@ -0,0 +1,13 @@
{
"id": "example-lab",
"description": "Example bench — replace MACs and network with your hardware",
"network": 1,
"master_mac": "50:78:7d:18:00:10",
"slaves": [
{
"id": "pod-1",
"mac": "50:78:7d:18:01:10",
"client_id": 16
}
]
}
+51
View File
@@ -0,0 +1,51 @@
{
"id": "smoke",
"description": "Basic master UART checks (no slaves required for version)",
"config": "example-lab",
"steps": [
{
"name": "firmware version",
"command": "version",
"expect": {
"version_min": 1
}
},
{
"name": "wait for ESP-NOW join",
"delay_ms": 5000
},
{
"name": "slave visible",
"command": "clients",
"expect": {
"min_clients": 1,
"slave": "pod-1",
"available": true
}
},
{
"name": "unicast path",
"command": "unicast_test",
"input": {
"slave": "pod-1",
"seq": 42
},
"expect": {
"success": true,
"seq": 42
}
},
{
"name": "read local deadzone",
"command": "deadzone",
"input": {
"write": false,
"client": 0
},
"expect": {
"success": true,
"deadzone": 100
}
}
]
}