From dafe1332f995e93392e27cd988ee4439f6767e71 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Thu, 24 Sep 2026 19:36:19 -0700 Subject: [PATCH] Exercise Companion power-off dispatch in host harness --- test/test_local_cli_access.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_local_cli_access.py b/test/test_local_cli_access.py index a8fa61cf4..3a30ae8b5 100644 --- a/test/test_local_cli_access.py +++ b/test/test_local_cli_access.py @@ -77,8 +77,10 @@ struct Prefs { void clearDirty(){} }; struct Board { + int power_offs=0; bool rebootToUf2Bootloader(){return false;} bool handleCommand(const char*,uint32_t,char*){return false;} + void powerOff(){++power_offs;} } board; struct Radio {bool setTxPower(int){return true;}} radio_driver; struct AdvertDataParser {static bool isValidName(const char*){return true;}}; @@ -204,6 +206,13 @@ int main() { node.store.success=false; assert(node.handleCommand("erase",0,reply)); assert(node.resets==1 && strstr(reply,"Err")); + for(const char* command:{"poweroff","shutdown"}) { + const int previous=board.power_offs; + node.handleCommand(command,100,reply); + assert(board.power_offs==previous); + assert(node.handleCommand(command,0,reply)); + assert(!strcmp(reply,"OK") && board.power_offs==previous+1); + } } '''