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:
+1
-21
@@ -3,33 +3,13 @@ package main
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"powerpod/gotool/pb"
|
||||
)
|
||||
|
||||
func runClients(sp *serialPort) error {
|
||||
payload, err := sp.exchange(byte(pb.MessageType_CLIENT_INFO), "CLIENT_INFO")
|
||||
clients, err := sp.listClients()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var msg pb.UartMessage
|
||||
if err := proto.Unmarshal(payload[1:], &msg); err != nil {
|
||||
return fmt.Errorf("decode protobuf: %w", err)
|
||||
}
|
||||
|
||||
if msg.GetType() != pb.MessageType_CLIENT_INFO {
|
||||
return fmt.Errorf("unexpected message type %v", msg.GetType())
|
||||
}
|
||||
|
||||
info := msg.GetClientInfoResponse()
|
||||
if info == nil {
|
||||
return fmt.Errorf("response missing client_info_response")
|
||||
}
|
||||
|
||||
clients := info.GetClients()
|
||||
if len(clients) == 0 {
|
||||
fmt.Println("no clients registered")
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user