From 3f062740eb6ff39f3fe4f4efe61198210dc5ccf5 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Sun, 18 Oct 2026 22:01:46 -0700 Subject: [PATCH] Keep extracted command fixtures independent of regulator storage --- test/fixtures/companion_fleet_dispatch.h | 1 + test/fixtures/regulator_cli_stub.h | 10 ++++++++++ test/test_companion_fleet_control.py | 8 ++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/regulator_cli_stub.h diff --git a/test/fixtures/companion_fleet_dispatch.h b/test/fixtures/companion_fleet_dispatch.h index 60bfb9473..519f0b9b5 100644 --- a/test/fixtures/companion_fleet_dispatch.h +++ b/test/fixtures/companion_fleet_dispatch.h @@ -6,6 +6,7 @@ #include #include #include +#include "regulator_cli_stub.h" // These narrower dispatch fixtures retain the complete production fleet branch // but have no channel peripheral. The separate companion fleet suite compiles diff --git a/test/fixtures/regulator_cli_stub.h b/test/fixtures/regulator_cli_stub.h new file mode 100644 index 000000000..df98ea171 --- /dev/null +++ b/test/fixtures/regulator_cli_stub.h @@ -0,0 +1,10 @@ +#pragma once +#include + +// These dispatch fixtures isolate another command family from the regulator +// subsystem. Its real settings, reset and persistence paths have dedicated +// executable tests in test_regulator_settings.py; an unrelated command falls +// through without changing the reply or requiring a board/filesystem adapter. +namespace mesh { namespace power { +inline bool handleRegulatorCommand(const char*, char*, size_t) { return false; } +}} diff --git a/test/test_companion_fleet_control.py b/test/test_companion_fleet_control.py index 6c8ce511e..cac51540d 100644 --- a/test/test_companion_fleet_control.py +++ b/test/test_companion_fleet_control.py @@ -27,6 +27,7 @@ HARNESS = r''' #include #include #include +#include "regulator_cli_stub.h" #include #include @@ -1286,7 +1287,7 @@ class CompanionFleetControlTests(unittest.TestCase): compiler, "-std=c++17", "-Wall", "-Wextra", "-Werror", "-Wno-unused-parameter", "-O2", *sanitizer_flags, "-fstack-usage", "-isystem", str(ROOT / "test/mocks"), - "-I", str(ROOT / "src"), str(fixture), + "-I", str(ROOT / "src"), "-I", str(ROOT / "test/fixtures"), str(fixture), str(ROOT / "src/helpers/FleetCommand.cpp"), "-lcrypto", "-o", str(cls.binary), ], capture_output=True, text=True, timeout=60) if result.returncode: @@ -1353,6 +1354,7 @@ class CompanionFleetControlTests(unittest.TestCase): self.compiler, "-std=c++17", "-Wall", "-Wextra", "-Werror", "-Wno-unused-parameter", "-DSTM32_PLATFORM=1", "-O2", *self.sanitizer_flags, "-isystem", str(ROOT / "test/mocks"), "-I", str(ROOT / "src"), + "-I", str(ROOT / "test/fixtures"), str(self.fixture), str(ROOT / "src/helpers/FleetCommand.cpp"), "-lcrypto", "-o", str(binary), ], capture_output=True, text=True, timeout=60) @@ -1449,6 +1451,7 @@ class CompanionFleetControlTests(unittest.TestCase): #include #include #include +#include "regulator_cli_stub.h" static_assert(MESH_ENABLE_FLEET_CONTROL == 0, "compact profile must disable fleet"); // No channels, clock, signing identity, codec definitions or sendGroupData. class MyMesh { @@ -1474,7 +1477,8 @@ int main() { built = subprocess.run([ self.compiler, "-std=c++17", "-Wall", "-Wextra", "-Werror", "-Wno-unused-parameter", "-isystem", str(ROOT / "test/mocks"), - "-I", str(ROOT / "src"), *flags, str(source), "-o", str(executable), + "-I", str(ROOT / "src"), "-I", str(ROOT / "test/fixtures"), + *flags, str(source), "-o", str(executable), ], capture_output=True, text=True, timeout=60) self.assertEqual(built.returncode, 0, built.stdout + built.stderr) result = subprocess.run([str(executable)], capture_output=True,