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:
2026-05-18 23:44:58 +02:00
co-authored by Cursor
parent d24b0cb5c3
commit 0299ba44fd
10 changed files with 268 additions and 45 deletions
+25 -2
View File
@@ -9,7 +9,7 @@ import (
"powerpod/gotool/autotest"
)
func runTest(sp *serialPort, args []string) error {
func runTest(portOverride string, baudOverride int, args []string) error {
fs := flag.NewFlagSet("test", flag.ExitOnError)
configName := fs.String("config", "", "bench config id or path (testdata/configs/)")
scenarioName := fs.String("scenario", "", "scenario id or path (testdata/scenarios/)")
@@ -49,14 +49,37 @@ func runTest(sp *serialPort, args []string) error {
return fmt.Errorf("load scenario: %w", err)
}
port := portOverride
if port == "" {
port = bench.UART.Master
}
baud := baudOverride
if baud <= 0 {
baud = int(bench.UART.Baud)
}
sp, err := openSerial(port, baud)
if err != nil {
return fmt.Errorf("open %s: %w", port, err)
}
defer sp.Close()
if !*verbose {
log.SetOutput(io.Discard)
}
fmt.Printf("bench config %q (network %d, master %s)\n",
bench.ID, bench.Network, bench.MasterMAC)
fmt.Printf(" uart.master %s (baud %d)\n", bench.UART.Master, bench.UART.Baud)
if bench.UART.MasterConsole != "" {
fmt.Printf(" uart.master_console %s\n", bench.UART.MasterConsole)
}
for _, s := range bench.Slaves {
fmt.Printf(" slave %q mac=%s client_id=%d\n", s.ID, s.MAC, *s.ClientID)
line := fmt.Sprintf(" slave %q mac=%s client_id=%d", s.ID, s.MAC, *s.ClientID)
if s.Console != "" {
line += fmt.Sprintf(" console=%s", s.Console)
}
fmt.Println(line)
}
fmt.Printf("scenario %q (%d steps)\n\n", sc.ID, len(sc.Steps))