Add CI test checking header only edition does not collide symbols - #181
Open
yaroslavaristov wants to merge 6 commits into
Open
Add CI test checking header only edition does not collide symbols#181yaroslavaristov wants to merge 6 commits into
yaroslavaristov wants to merge 6 commits into
Conversation
… detect real symbol collisions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10
Problem
programs/collision-checkalready existed but didn't actually test fora collision. It built a single shared library (
lib.cpp, compiledwith
LIBNO=1) and rannm -Don it to check for non-inline exportedLLFIO symbols.
LIBNOwas never used with a second value anywhere inthe 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.cpp→programs/collision-check/lib1.cppRenamed for symmetry with the new
lib2.cpp. Content unchanged.programs/collision-check/lib2.cpp(new)Second translation unit, identical to
lib1.cpp, independentlyincluding
llfio.hppand exportingmake_file2(). Built into itsown 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 twoheader-only inclusions clash, this target fails to link or crashes
at load time.
programs/collision-check/CMakeLists.txt(rewritten)llfio-collision-check-lib1andllfio-collision-check-lib2from
lib1.cpp/lib2.cppin a loop.llfio-collision-checkexecutable frommain.cpp, linkedagainst both libraries.
add_test(NAME llfio-collision-check ...)so it runs under
ctest.nm -D | grepnon-inline-symbol check, now runagainst both shared objects instead of just one.
programs/CMakeLists.txtAdded
enable_testing()right after theproject()call. Withoutit,
add_test()in the collision-check subdirectory never registerswith
ctest, so the new test would silently not run..github/workflows/programs.ymlAdded a
Run collision-checkstep afterBuild, restricted toLinux, that runs
ctest -R llfio-collision-check --output-on-failure.Previously the workflow only compiled
programs/; it never executedanything, so this test would build but never actually run in CI.
Notes
collision-check(the
WIN32 OR APPLEguard at the top of the CMakeLists isunchanged) — the
nm-based symbol visibility check is POSIX/ELFspecific.
infrastructure.