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
+1 -31
View File
@@ -3,10 +3,6 @@ package main
import (
"flag"
"fmt"
"google.golang.org/protobuf/proto"
"powerpod/gotool/pb"
)
func runUnicastTest(sp *serialPort, args []string) error {
@@ -20,37 +16,11 @@ func runUnicastTest(sp *serialPort, args []string) error {
return fmt.Errorf("client id required (see `gotool clients`)")
}
req := &pb.EspNowUnicastTestRequest{
ClientId: uint32(*clientID),
Seq: uint32(*seq),
}
msg := &pb.UartMessage{
Type: pb.MessageType_ESPNOW_UNICAST_TEST,
Payload: &pb.UartMessage_EspnowUnicastTestRequest{
EspnowUnicastTestRequest: req,
},
}
body, err := proto.Marshal(msg)
if err != nil {
return fmt.Errorf("encode request: %w", err)
}
payload := append([]byte{byte(pb.MessageType_ESPNOW_UNICAST_TEST)}, body...)
respPayload, err := sp.exchangePayload(payload, "ESPNOW_UNICAST_TEST")
r, err := sp.espnowUnicastTest(uint32(*clientID), uint32(*seq))
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.GetEspnowUnicastTestResponse()
if r == nil {
return fmt.Errorf("response missing espnow_unicast_test_response")
}
fmt.Printf("unicast test sent: success=%v seq=%d\n", r.GetSuccess(), r.GetSeq())
return nil
}