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>
This commit is contained in:
Vendored
+33
-12
@@ -2,29 +2,35 @@
|
||||
|
||||
## Bench config (`configs/*.json`)
|
||||
|
||||
Describes your hardware bench (for documentation and slave lookup in tests).
|
||||
Describes your hardware bench: network, MACs, and serial ports.
|
||||
|
||||
| Field | Meaning |
|
||||
|-------|---------|
|
||||
| `id` | Config name; referenced by scenarios |
|
||||
| `network` | ESP-NOW network **1–8** (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`) |
|
||||
| `network` | ESP-NOW network **1–8** (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` to e.g. `my-lab.json` and set real MACs.
|
||||
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 with `input` and `expect`.
|
||||
Ordered steps: UART commands, delays, or esptool reset.
|
||||
|
||||
| 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 |
|
||||
| `command` | See below |
|
||||
| `input` | Command arguments |
|
||||
| `expect` | Assertions (UART commands only) |
|
||||
|
||||
### Commands
|
||||
|
||||
@@ -38,10 +44,25 @@ Ordered steps: UART commands with `input` and `expect`.
|
||||
**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 . -port /dev/ttyUSB0 test -config my-lab -scenario smoke
|
||||
go run . -port /dev/ttyUSB0 test -list-configs
|
||||
go run . test -config example-lab -scenario smoke
|
||||
go run . test -config my-lab -scenario smoke -port /dev/ttyUSB1
|
||||
go run . test -list-configs
|
||||
```
|
||||
|
||||
+8
-2
@@ -1,13 +1,19 @@
|
||||
{
|
||||
"id": "example-lab",
|
||||
"description": "Example bench — replace MACs and network with your hardware",
|
||||
"description": "Example bench — replace MACs, network, and serial paths",
|
||||
"network": 1,
|
||||
"master_mac": "50:78:7d:18:00:10",
|
||||
"uart": {
|
||||
"baud": 921600,
|
||||
"master": "/dev/ttyUSB0",
|
||||
"master_console": "/dev/ttyACM0"
|
||||
},
|
||||
"slaves": [
|
||||
{
|
||||
"id": "pod-1",
|
||||
"mac": "50:78:7d:18:01:10",
|
||||
"client_id": 16
|
||||
"client_id": 16,
|
||||
"console": "/dev/ttyACM1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+15
-7
@@ -1,21 +1,29 @@
|
||||
{
|
||||
"id": "smoke",
|
||||
"description": "Basic master UART checks (no slaves required for version)",
|
||||
"description": "Cold-start smoke: reset all nodes, wait for join, then UART checks",
|
||||
"config": "example-lab",
|
||||
"steps": [
|
||||
{
|
||||
"name": "firmware version",
|
||||
"name": "reset all nodes",
|
||||
"command": "reset",
|
||||
"input": {
|
||||
"all": true,
|
||||
"wait_ms": 2500
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "boot and ESP-NOW join",
|
||||
"delay_ms": 10000
|
||||
},
|
||||
{
|
||||
"name": "master UART up",
|
||||
"command": "version",
|
||||
"expect": {
|
||||
"version_min": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "wait for ESP-NOW join",
|
||||
"delay_ms": 5000
|
||||
},
|
||||
{
|
||||
"name": "slave visible",
|
||||
"name": "slave registered",
|
||||
"command": "clients",
|
||||
"expect": {
|
||||
"min_clients": 1,
|
||||
|
||||
Reference in New Issue
Block a user