Skip to content

Three test files register no tests at all — and one hides a segfault #4201

Closed

Description

@zackees

Three test files register no test cases at all. Their FL_TEST_CASE bodies compile into the shared object — the strings are in the binary — but nothing runs them, and the suite reports success.

tests/fl/system/pin.cpp
tests/fl/channels/channel.cpp
tests/fl/math/xymap.cpp

All three #include "fl/test/fltest.h" directly. Every test file that actually runs includes "test.h" instead.

How to confirm it

Plant a guaranteed failure in any test case in one of those files:

FL_CHECK_EQ(1, 2);

bash test channel --cpp reports All tests passed. Change that file's include from fl/test/fltest.h to test.h and the same planted failure is caught immediately. Running the built object directly agrees:

$ ./.build/meson-quick/tests/runner .build/meson-quick/tests/fl_channels_channel.so
[doctest] test cases: 0 | 0 passed | 0 failed

against, for comparison, a file that includes test.h:

$ ./.build/meson-quick/tests/runner .build/meson-quick/tests/fl_gfx_pipeline.so
[doctest] test cases: 6 | 6 passed | 0 failed

tests/fl/test/fltest.cpp is presumably legitimate — it is the harness's own test — but the other three look like accidents.

What it has been hiding

tests/fl/channels/channel.cpp holds four cases covering serpentine addressing, colour order, and the #1009 shared-array regression. Switching its include to test.h and running them segfaults:

#2  fl::detail::ScaledPixelIteratorRGB::advance()
#3  fl::detail::ScaledPixelIteratorRGB::ScaledPixelIteratorRGB(fl::PixelIterator*)
#4  fl::makeScaledPixelRangeRGB(fl::PixelIterator*)
#5  fl::PixelIterator::writeAPA102<fl::vector_psram<unsigned char>>(...)
#6  fl::Channel::showPixels(PixelController<(fl::EOrder)10, 1, 4294967295>&)

on the first case, "Serpentine 2x2 with APA102 encodes pixels in expected byte order".

That crash is pre-existing and unrelated to any current work: I reproduced it on master with nothing changed but the one-line include swap and an FL_TEST_FILE wrapper. I have not investigated it further — it wants someone with context on the APA102 scaled-iterator path.

Suggested order

  1. Fix the includes on the three files. That is one line each.
  2. Expect channel.cpp to fail immediately, and treat the segfault as its own bug.
  3. Consider making this unrepresentable — a lint rule that a file under tests/ defining FL_TEST_CASE must include test.h, or having fltest.h refuse to be included directly outside the harness. Three files drifted here without anyone noticing, so the convention is not self-enforcing.

Found while adding an end-to-end test for #4040; that test was moved to a file that runs (tests/fl/channels/color_managed_source.cpp) rather than added to a dormant one, and #4200 does not touch any of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions