Skip to content

test: wake 78 tests that had never run, and guard against it recurring (#4201) - #4232

Merged
zackees merged 1 commit into
masterfrom
fix/4201-dormant-test-files
Sep 9, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/4201-dormant-test-files

Conversation

@zackees

@zackees zackees commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Fixes two of the three files in #4201 and stops the class of bug recurring.

FL_TEST_CASE bodies compile whether or not anything runs them. What makes them run is #include "test.h", which pulls in the registration harness; including fl/test/fltest.h directly compiles the same macros into a translation unit that registers nothing — and the suite reports success.

file cases result once they run
tests/fl/system/pin.cpp 61 all pass
tests/fl/math/xymap.cpp 17 one was failing

xymap.cpp also needed the FL_TEST_FILE wrapper it never had.

The failing one is the argument for the change

"Corner case: All max brightness buffer with addressing" wrote:

CRGB input[4] = {CRGB::White};

which initializes element 0 and value-initializes the other three to black — then asserted 255 on all four. It has been wrong since it was written, and nothing could say so.

One file stays dormant, deliberately

tests/fl/channels/channel.cpp still includes the wrong header. Enabling it segfaults in ScaledPixelIteratorRGB::advance() via writeAPA102, and I reproduced that on a clean checkout with nothing changed but the include — so it predates the discovery and wants someone with context on that path rather than a guess from me.

The guard

ci/tests/test_every_test_file_registers.py asserts every test file defining a case includes test.h. The dormant file is a single named exemption, not a pattern, and a second assertion pins that list at exactly one entry — so waving a new dormant file through has to be a visible edit a reviewer sees.

Checked by mutation: removing the exemption fails the sweep on channel.cpp, which is the case the guard exists to catch. It also asserts its own regexes match what they claim and don't fire on a case name inside a comment.

Closes part of #4201; the segfault half stays open there.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Summary by CodeRabbit

  • Tests
    • Added validation to ensure every test source containing test cases properly registers them.
    • Updated math and system test files to use the standard test harness.
    • Corrected pixel initialization in a brightness-buffer test so all inputs are explicitly set to white.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ca077353-0a35-4e56-adbb-ee8d6dfb78d1

📥 Commits

Reviewing files that changed from the base of the PR and between 3319e6b and 33cc51c.

📒 Files selected for processing (3)
  • ci/tests/test_every_test_file_registers.py
  • tests/fl/math/xymap.cpp
  • tests/fl/system/pin.cpp

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change standardizes test harness inclusion, registers the xymap test file, corrects its pixel initialization, removes the legacy include from pin.cpp, and adds a CI audit for unregistered test cases.

Changes

Test registration coverage

Layer / File(s) Summary
Adopt the test registration harness
tests/fl/math/xymap.cpp, tests/fl/system/pin.cpp
xymap.cpp now uses test.h and FL_TEST_FILE(FL_FILEPATH). Its brightness test initializes all four pixels to CRGB::White. pin.cpp replaces the legacy harness include with test.h.
Enforce registration coverage
ci/tests/test_every_test_file_registers.py
The new unittest scans test sources for FL_TEST_CASE definitions without test.h, validates the dormant-file exemption, and checks the detection regexes.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 34df5

This change activates previously dormant pin and xymap tests, corrects the xymap brightness fixture, and adds a CI check to prevent further unregistered test cases. No merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant TestRunner
  participant TestEveryTestFileRegisters
  participant TestSources
  TestRunner->>TestEveryTestFileRegisters: run registration checks
  TestEveryTestFileRegisters->>TestSources: collect_sources()
  TestSources-->>TestEveryTestFileRegisters: sorted *.cpp files
  TestEveryTestFileRegisters->>TestSources: inspect FL_TEST_CASE and test.h
  TestSources-->>TestEveryTestFileRegisters: matching or offending files
  TestEveryTestFileRegisters-->>TestRunner: test result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: activating dormant tests and adding a guard to prevent similar registration issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/4201-dormant-test-files

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

zackees added a commit that referenced this pull request Sep 9, 2026
…4234)

The gate is red on master itself, so every open PR fails it -- including
#4232, which touches only test files and CI Python.

Master's own run measures total_flash=342,409 B against a pinned 342,407 B.
No single PR regressed; the drift is the sum of six changes merged in one
burst on 2026-09-09 16:57-16:59Z, each measured against a base that
predated the others:

  #4204 342,393 B  (baseline 342,393, headroom 0)
  #4206 342,391 B  (baseline 342,393, headroom 2)
  #4213 342,391 B
  #4220 342,391 B
  #4221 342,391 B
  #4227 342,407 B  (baseline 342,407 -- raised in that PR, headroom 0)

Every one of them passed. Their combination is 2 B over. That is the
known limit of measuring each PR against its own merge base, not a
regression anyone shipped, so re-pinning to the measured value records
what master is rather than hiding anything: a PR that adds flash on top
of 342,409 B still fails.


Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
#4201)

`FL_TEST_CASE` bodies compile whether or not anything runs them. What makes
them run is `#include "test.h"`, which pulls in the registration harness;
including `fl/test/fltest.h` directly compiles the same macros into a
translation unit that registers nothing, and the suite reports success.

Two of the three files in #4201 are fixed here:

  tests/fl/system/pin.cpp    61 cases, all passing once they run
  tests/fl/math/xymap.cpp    17 cases, one of which was failing

`xymap.cpp` also needed the `FL_TEST_FILE` wrapper it never had.

The failing one is worth stating, because it is the argument for the whole
change. "Corner case: All max brightness buffer with addressing" wrote
`CRGB input[4] = {CRGB::White}`, which initializes element 0 and
value-initializes the other three to black, then asserted 255 on all four.
It has been wrong since it was written and nothing could say so.

The third file, `tests/fl/channels/channel.cpp`, stays dormant on purpose.
Enabling it segfaults in `ScaledPixelIteratorRGB::advance()` via
`writeAPA102` -- reproduced on a clean checkout with nothing changed but the
include, so it predates the discovery and wants someone with context on that
path.

`ci/tests/test_every_test_file_registers.py` asserts the shape so this cannot
drift back. The dormant file is a single named exemption rather than a
pattern, and a second assertion pins that list at exactly one entry, so
adding another has to be a visible edit a reviewer sees. Checked by mutation:
removing the exemption fails the sweep on `channel.cpp`, which is the case
the guard exists to catch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
@zackees
zackees force-pushed the fix/4201-dormant-test-files branch from 33cc51c to 34df574 Compare September 9, 2026 17:38
@zackees
zackees merged commit d75a88c into master Sep 9, 2026
30 of 34 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 9, 2026
@zackees
zackees deleted the fix/4201-dormant-test-files branch November 5, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant