test(firmware): broaden native-test coverage + gcov instrumentation

Extract the pre-first-image retry from normal_operation() into a
templated bootstrap_loop() helper in operation.h so the loop body
becomes unit-testable. Add four tests against it: two that verify the
X-Panel-Id header is sent on every poll and matches the compile-time
PANEL_ID (a silent server-side mis-routing risk if dropped), and two
that exercise the loop's exit-on-deep-sleep vs. iterate-while-204
behaviour.

Wire --coverage into env:native-test (compile + link via a post-script)
so `gcovr -r . --filter src/` produces a real number, and ignore the
stray *.gcov files gcovr drops at the repo root.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 16:25:00 -04:00
parent 013e49d859
commit e9f2ec0629
7 changed files with 118 additions and 5 deletions
+6
View File
@@ -0,0 +1,6 @@
# Adds --coverage to the link step for env:native-test, so gcov's runtime
# (libgcov) gets linked alongside the instrumented objects. build_flags
# already pushes --coverage through compile; the linker needs it too or
# the program fails with undefined references to __gcov_init / etc.
Import("env")
env.Append(LINKFLAGS=["--coverage"])