From ba3fcc2cabb6554fd0973a14ea99bbf72e294641 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Wed, 28 Oct 2026 05:34:58 -0700 Subject: [PATCH] Align clock and console fixtures with current CLI helpers --- test/fixtures/morse_main_loop.cpp | 1 + test/fixtures/official_web_console/firmware.cpp | 1 + test/test_fleet_clock_control.py | 1 + test/test_host_kiss_infrastructure.py | 1 + test/test_official_config_gui.py | 14 ++++++++++---- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test/fixtures/morse_main_loop.cpp b/test/fixtures/morse_main_loop.cpp index da6f1fb93..1435c2ec0 100644 --- a/test/fixtures/morse_main_loop.cpp +++ b/test/fixtures/morse_main_loop.cpp @@ -34,6 +34,7 @@ bool isUsbLoggingWatchdogArmed() { return usb_watchdog_armed; } bool serviceUsbLoggingWatchdog(bool(*)()) { ++usb_services; return false; } Stream& usbConsolePort() { return console; } void noteUsbLoggingStatsCommand(const char*) { ++usb_services; } +void noteUsbConsoleCommand(const char*) { ++usb_services; } namespace wireless { struct Control { void service(uint32_t) { ++transport_services; } bool pending() { return wireless_pending; } } controller; Control& control() { return controller; } diff --git a/test/fixtures/official_web_console/firmware.cpp b/test/fixtures/official_web_console/firmware.cpp index c755caab8..d092cee97 100644 --- a/test/fixtures/official_web_console/firmware.cpp +++ b/test/fixtures/official_web_console/firmware.cpp @@ -34,6 +34,7 @@ bool takeUsbTerminalSessionReset() { return false; } bool tryCompleteUsbTerminalSessionReset() { return true; } bool canAcceptUsbConsoleCommand() { return true; } Stream& usbConsolePort() { return console; } +void noteUsbConsoleCommand(const char*) {} void noteUsbLoggingStatsCommand(const char*) {} bool isUsbLoggingWatchdogArmed() { return false; } namespace wireless { diff --git a/test/test_fleet_clock_control.py b/test/test_fleet_clock_control.py index 6a2d6c992..3967ad8eb 100644 --- a/test/test_fleet_clock_control.py +++ b/test/test_fleet_clock_control.py @@ -22,6 +22,7 @@ ROOT = Path(__file__).resolve().parents[1] HARNESS = r''' #include +#include // Date formatting is a host peripheral adapter; it never mutates the RTC. class DateTime { diff --git a/test/test_host_kiss_infrastructure.py b/test/test_host_kiss_infrastructure.py index 75a11428d..1b99a7e19 100644 --- a/test/test_host_kiss_infrastructure.py +++ b/test/test_host_kiss_infrastructure.py @@ -50,6 +50,7 @@ bool tryCompleteUsbTerminalSessionReset() { return true; } bool canAcceptUsbConsoleCommand() { return true; } Stream& usbConsolePort() { return console; } void noteUsbLoggingStatsCommand(const char*) {} +void noteUsbConsoleCommand(const char*) {} namespace power { void serviceRegulatorSettings() {} } #if MESH_ENABLE_HOST_KISS namespace hostkiss { diff --git a/test/test_official_config_gui.py b/test/test_official_config_gui.py index 65c318e94..3a95ff5f0 100644 --- a/test/test_official_config_gui.py +++ b/test/test_official_config_gui.py @@ -191,6 +191,7 @@ def cli_source(*, lf_reply=False, reject_cr=False, platform="ESP32_PLATFORM", common = (ROOT / "src/helpers/CommonCLI.cpp").read_text() time_handler = body(common, 'if (memcmp(command, "time ", 5) == 0)') support = r''' +#include struct RTC { uint32_t utc=1715770351; uint32_t getCurrentTime(){return utc;} void setCurrentTime(uint32_t value){utc=value;} } rtc; struct ClockCallbacks { void onManualClockSet(){} } clock_callbacks; @@ -225,7 +226,8 @@ class OfficialConfigGuiTests(unittest.TestCase): def run_contract(self, *, blocking=False, lf_reply=False, reject_cr=False, extra_boot_ms=0, platform="ESP32_PLATFORM", raw_uart=False, - preconnect_idle_ms=0, lose_raw_uart_guard=False): + preconnect_idle_ms=0, lose_raw_uart_guard=False, + compact_replies=False): with tempfile.TemporaryDirectory(prefix="official-config-gui-") as directory: work = Path(directory) gui = self.sources["src/gui.js"].read_text() @@ -281,7 +283,8 @@ class OfficialConfigGuiTests(unittest.TestCase): "-DCONFIG_TINYUSB_ENABLED=0"] cli_sources = [] command = [self.compiler, "-std=c++17", "-Wall", "-Wextra", - *cli_flags, *sanitize, "-I", str(ROOT / "src"), + *cli_flags, f"-DMESH_CLI_COMPACT_REPLIES={int(compact_replies)}", + *sanitize, "-I", str(ROOT / "src"), str(cli_cpp), *cli_sources, "-o", str(cli)] built = subprocess.run(command, text=True, capture_output=True, timeout=60) self.assertEqual(built.returncode, 0, built.stdout + built.stderr) @@ -351,8 +354,11 @@ class OfficialConfigGuiTests(unittest.TestCase): # Use nRF52's compiled GPS guards, actual USB transport/callbacks and # production repeater CR command pump/time reply with DTR low. Add # setup's one-second settle; filesystem/radio timing is not invented. - result = self.run_contract(platform="NRF52_PLATFORM", extra_boot_ms=1000) - self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + for compact in (False, True): + with self.subTest(compact_replies=compact): + result = self.run_contract(platform="NRF52_PLATFORM", extra_boot_ms=1000, + compact_replies=compact) + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) def test_nrf52_old_blocking_gps_breaks_stock_gui_initial_time(self): # Reinsert the former five-second GPS wait without changing the