Skip to content

Add CI test checking header only edition does not collide symbols - #181

Open
yaroslavaristov wants to merge 6 commits into
ned14:developfrom
yaroslavaristov:collision-check-two-libraries
Open

Add CI test checking header only edition does not collide symbols#181
yaroslavaristov wants to merge 6 commits into
ned14:developfrom
yaroslavaristov:collision-check-two-libraries

Conversation

@yaroslavaristov

Copy link
Copy Markdown

Closes #10

Problem

programs/collision-check already existed but didn't actually test for
a collision. It built a single shared library (lib.cpp, compiled
with LIBNO=1) and ran nm -D on it to check for non-inline exported
LLFIO symbols. LIBNO was never used with a second value anywhere in
the project, so there was no second library to collide with, and
nothing ever linked two independent header-only inclusions of LLFIO
together to see what happens.

What this PR does

Builds two independent shared libraries, each of which includes the
LLFIO headers in header-only mode in complete isolation from the
other, then links both into a single executable. If header-only LLFIO
ever leaks a non-inline symbol, this either fails outright at link
time (duplicate symbol) or produces a silent ODR violation at load
time — both of which now show up as a CI failure instead of going
unnoticed.

Changes

  • programs/collision-check/lib.cppprograms/collision-check/lib1.cpp
    Renamed for symmetry with the new lib2.cpp. Content unchanged.

  • programs/collision-check/lib2.cpp (new)
    Second translation unit, identical to lib1.cpp, independently
    including llfio.hpp and exporting make_file2(). Built into its
    own shared object with LIBNO=2.

  • programs/collision-check/main.cpp (new)
    Links both shared objects into one executable, calls make_file1()
    and make_file2(). This is the actual collision test: if the two
    header-only inclusions clash, this target fails to link or crashes
    at load time.

  • programs/collision-check/CMakeLists.txt (rewritten)

    • Builds llfio-collision-check-lib1 and llfio-collision-check-lib2
      from lib1.cpp / lib2.cpp in a loop.
    • Builds llfio-collision-check executable from main.cpp, linked
      against both libraries.
    • Registers the executable with add_test(NAME llfio-collision-check ...)
      so it runs under ctest.
    • Keeps the existing nm -D | grep non-inline-symbol check, now run
      against both shared objects instead of just one.
  • programs/CMakeLists.txt
    Added enable_testing() right after the project() call. Without
    it, add_test() in the collision-check subdirectory never registers
    with ctest, so the new test would silently not run.

  • .github/workflows/programs.yml
    Added a Run collision-check step after Build, restricted to
    Linux, that runs ctest -R llfio-collision-check --output-on-failure.
    Previously the workflow only compiled programs/; it never executed
    anything, so this test would build but never actually run in CI.

Notes

  • Still Linux-only, same restriction as the original collision-check
    (the WIN32 OR APPLE guard at the top of the CMakeLists is
    unchanged) — the nm-based symbol visibility check is POSIX/ELF
    specific.
  • No changes to any LLFIO library code — this only adds test
    infrastructure.

Copilot AI lite review requested due to automatic review settings August 19, 2026 12:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CI test checking that header only edition does not collide symbols

2 participants