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
+6 -31
View File
@@ -4,8 +4,6 @@ import (
"flag"
"fmt"
"google.golang.org/protobuf/proto"
"powerpod/gotool/pb"
)
@@ -19,39 +17,16 @@ func runDeadzone(sp *serialPort, args []string) error {
return err
}
req := &pb.AccelDeadzoneRequest{
Write: *write,
Deadzone: uint32(*deadzone),
ClientId: uint32(*clientID),
AllClients: *all,
}
msg := &pb.UartMessage{
Type: pb.MessageType_ACCEL_DEADZONE,
Payload: &pb.UartMessage_AccelDeadzoneRequest{
AccelDeadzoneRequest: req,
},
}
body, err := proto.Marshal(msg)
if err != nil {
return fmt.Errorf("encode request: %w", err)
}
payload := append([]byte{byte(pb.MessageType_ACCEL_DEADZONE)}, body...)
respPayload, err := sp.exchangePayload(payload, "ACCEL_DEADZONE")
r, err := sp.accelDeadzone(&pb.AccelDeadzoneRequest{
Write: *write,
Deadzone: uint32(*deadzone),
ClientId: uint32(*clientID),
AllClients: *all,
})
if err != nil {
return err
}
var respMsg pb.UartMessage
if err := proto.Unmarshal(respPayload[1:], &respMsg); err != nil {
return fmt.Errorf("decode response: %w", err)
}
r := respMsg.GetAccelDeadzoneResponse()
if r == nil {
return fmt.Errorf("response missing accel_deadzone_response")
}
fmt.Printf("deadzone=%d client_id=%d success=%v slaves_updated=%d\n",
r.GetDeadzone(), r.GetClientId(), r.GetSuccess(), r.GetSlavesUpdated())
return nil