Repository navigation
[BUILD,INTERNAL] Move the class-test framework into its own library (OpenMSTestFramework) - #9919
timosachsenberg wants to merge 17 commits into
Conversation
Root cause of the
|
| develop | this PR (before fix) | |
|---|---|---|
| Thrift symbols in test executable | 0 | 504 |
Exported (.dynsym) Thrift symbols |
0 | 391 |
ConsensusMapArrowExport_test size |
806 KB | 19.5 MB |
| Result | passes 5/5 | aborts 3/3 |
libOpenMS.so is identical in both (382 defined / 10 undefined Thrift symbols). The difference is purely link order:
- develop:
libOpenMS.so…libarrow.alibparquet.a— the Arrow/Parquet references are already satisfied by libOpenMS.so, so no archive members are pulled in. - this PR:
libOpenMSTestFramework.alibarrow.alibparquet.a…libOpenMS.so— declaringOpenMSa link dependency of the newOpenMSTestFrameworkforced CMake to place libOpenMS.so after it, and hence behind the static archives. The linker satisfied Arrow/Parquet from the archives, dragging their objects — including the Thrift enum-name statics — into every affected test executable.
Both binaries then contained (and exported) the same weak Thrift statics. The executable wins global symbol resolution, so libOpenMS.so bound to the executable's copy and registered an atexit destructor for it → destroyed once by the executable's exit handlers and once by __cxa_finalize() during dlclose/_dl_fini → heap corruption → the next free() (from libomp's shutdown) aborts.
This also explains the platform pattern: it needs ARROW_USE_STATIC=ON (the default) plus ELF symbol interposition, so macOS and Windows were unaffected, and on ARM it was intermittent (OpenSwathExport_test's plain rerun exited 0 there while valgrind still caught the double free).
Fixes (61cfde0, 58d92f7)
- Restore the link order — the framework propagates OpenMS' include dirs and compile definitions as usage requirements instead of a link edge, so libOpenMS.so precedes the static archives again. The OpenSwathAlgo tests, which relied on the transitive dependency, now name
OpenMSexplicitly (after the framework archive — their own sources reference no OpenMS symbols, so--as-neededwould otherwise drop it). - Defense in depth — new
openms_hide_static_archive_symbols()links class tests with--exclude-libs,ALL, so archive symbols stay out of the executable's dynamic table even if something is pulled in later. GNU ld/lld only.
Verified locally with clang + static Arrow (the CI configuration): ConsensusMapArrowExport_test back to 902 KB with 0 Thrift symbols, and the Arrow, OpenSwathAlgo, framework, XML-format and TOPP_FuzzyDiff tests all pass.
Note the temporary diagnostic step in test.yml (b2587c9) is still on the branch and must be reverted before merge — I'll drop it once this round of CI confirms green.
Generated by Claude Code
This comment was marked as resolved.
This comment was marked as resolved.
…Framework library Extract ClassTest.h, FuzzyStringComparator and MacrosTest.h from libOpenMS into src/testframework/ (static library OpenMSTestFramework) as prework for splitting libOpenMS into smaller libraries. Include paths and installed header locations are unchanged, so the 700+ existing tests need no changes. - ClassTest no longer hardwires the FORMAT layer: XML schema validation of NEW_TMP_FILE files at END_TEST and UniqueIdGenerator seeding at START_TEST are injected via setTmpFileValidator()/setTestInitHook(), registered by the new OpenMSTestSupport object library, which is linked into the openms and openms_gui class tests. This removes the framework's inverted CONCEPT -> FORMAT dependency. - FuzzyStringComparator uses a local CRLF-stripping getLine and std::filesystem instead of TextFile/File, cutting its FORMAT/SYSTEM dependencies; the FuzzyDiff tool links the new static library. - OpenSwathAlgo class tests now link OpenSwathAlgo + OpenMSTestFramework (libOpenMS only transitively, until the core split). - testTrue/testFalse in ClassTest.h are now inline: test executables gain a second TU that includes the header (OpenMSTestSupport), which would otherwise be an ODR violation. - The framework's symbols are no longer exported from libOpenMS (OPENMS_DLLAPI removed); the static archive is installed and exported as CMake target OpenMSTestFramework. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
Explain in plain language why the class-test framework is a standalone static library, which behavior is injected via the two hooks, and how the OpenMSTestSupport registration works. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
The include pruning in ClassTest.cpp / FuzzyStringComparator.cpp removed the FORMAT/SYSTEM headers that had transitively pulled in several std headers. libstdc++ still provides them through the remaining includes, libc++ (macOS) does not: std::exception_ptr in printLastException() was an incomplete type, failing the macos-15 CI job. Include everything used directly. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
The pyOpenMS wheel builds (and any other minimal install flow) build only 'ninja OpenMS OpenSwathAlgo' and install component-wise. Exporting the test-framework target made their installed OpenMSTargets.cmake reference lib/libOpenMSTestFramework.a, which is never built/installed there, so every downstream find_package(OpenMS) failed. The archive now installs under its own component (OpenMSTestFramework) and the target is no longer registered in the OpenMS export set; in-tree consumers (class tests, FuzzyDiff) link the target directly. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
…ORE MERGE Re-runs the three aborting tests on the failing Linux jobs and captures gdb backtraces from core dumps, a run under glibc malloc debugging, and a valgrind run with origin tracking. Gated on job failure, Linux only. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
With ARROW_USE_STATIC=ON (the default) the Arrow/Parquet archives, including the Thrift code bundled inside them, are linked into libOpenMS.so *and* into every test executable that links Arrow/Parquet directly. Both binaries then export the same weak Thrift template statics (the enum-name maps built from apache::thrift::TEnumIterator). The executable is searched first when the dynamic linker resolves global symbols, so libOpenMS.so binds to the executable's copy and registers an atexit destructor for it: the object is destroyed twice at teardown -- once via the executable's exit handlers, once via __cxa_finalize() when libOpenMS.so is unloaded. That corrupts the heap and aborts the process with "malloc_consolidate(): invalid chunk size" after all subtests have already passed. This is what made ConsensusMapArrowExport_test / QPXFile_test (clang++, x64) and OpenSwathExport_test (g++, arm) abort in CI. Diagnosis came from valgrind and core-dump backtraces captured in the failing jobs; the double free is visible as a use-after-free of the Thrift map, first freed from __run_exit_handlers and read again from __cxa_finalize. New helper openms_hide_static_archive_symbols() links the class tests with --exclude-libs,ALL so archive symbols stay out of the executable's dynamic symbol table and each binary uses its own copy. Verified locally with a static-Arrow build: exported Thrift symbols drop from 391 to 10 and ConsensusMapArrowExport_test goes from aborting 3/3 to passing 3/3. GNU ld and lld only -- the Apple linker has no equivalent option and Windows does not have symbol interposition. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
… linking tests Root cause of the CI aborts, found by comparing the failing binaries against develop: on develop the test executables contain no Thrift symbols at all, on this branch they contained 504 of them. Declaring OpenMS a link dependency of the new OpenMSTestFramework forced CMake to order libOpenMS.so *after* libOpenMSTestFramework.a on every consumer's link line -- and thereby behind the static libarrow.a/libparquet.a that the Arrow-related class tests link explicitly. The linker then satisfied the Arrow/Parquet references from those archives instead of from libOpenMS.so and pulled their objects, including the Thrift enum-name statics, into each test executable. Those duplicated statics were the objects destroyed twice at exit (see previous commit), and they also inflated the affected test binaries 24x (ConsensusMapArrowExport_test: 0.8 MB -> 19.5 MB). The framework now propagates OpenMS' include directories and compile definitions as usage requirements without the link edge, restoring develop's link order. Consumers link OpenMS themselves; the OpenSwathAlgo tests, which relied on getting it transitively, now name it explicitly -- after the framework archive, since their own sources reference no OpenMS symbols and the linker's default --as-needed would otherwise drop libOpenMS.so before the archive's references are seen. Verified with clang + static Arrow (the CI configuration): ConsensusMapArrowExport_test is back to 902 KB with 0 Thrift symbols, and the Arrow, OpenSwathAlgo, framework, XML-format and TOPP_FuzzyDiff tests all pass. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
…VERT BEFORE MERGE" This reverts commit b2587c9.
…rary The class-test framework no longer needs any injected behavior: - UniqueIdGenerator seeding now happens directly in ClassTest.cpp. The generator is CONCEPT level, the same layer the framework already uses for StringUtils/Exception/DataValue, so this adds no coupling it did not have. Boost::boost is declared on the target because UniqueIdGenerator.h includes boost/random headers (header-only, so no link-line entry and no effect on the link ordering the previous commit established). - XML schema validation, which does need the FORMAT layer, moved into the class-test project as the header-only OpenMS/TestFileValidation.h. Tests that write mzML/featureXML/idXML/consensusXML/INI/transformationXML call VALIDATE_TMP_FILES before END_TEST; VALIDATE_FILE(f) validates a single file and reports at the call site. setTestInitHook()/setTmpFileValidator() and the OpenMSTestSupport object library are gone, along with the static-initializer registration. Which tests need the explicit call was determined empirically, not guessed: all 57 tests that combine NEW_TMP_FILE with a validatable format were built and run against the previous hook-based build to record what each validated. 26 validate files and got the call; the other 31 produce nothing validatable. The openms_gui and openswathalgo tests use NEW_TMP_FILE zero times, so they only lose a link-line entry. Verified: each of the 26 validates exactly the same number of files as before, and 33 affected tests plus the TOPP_FuzzyDiff tests pass. Note this makes validation opt-in: a new test that writes an XML file is not schema-checked unless its author adds VALIDATE_TMP_FILES. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
The g++ CI jobs failed to link RAIICleanup_test after the support library was removed: libOpenMSTestFramework.a(ClassTest.cpp.o): undefined reference to `OpenMS::UniqueIdGenerator::setSeed(unsigned long)' The framework archive was listed after libOpenMS.so. With the linker's default --as-needed, libOpenMS.so is only kept if something already seen requires it; for a test whose own object references nothing from libOpenMS (RAIICleanup is header-only) it was dropped, and the archive's later references to Exception, StringUtils and UniqueIdGenerator then had nothing to resolve against. Until now OpenMSTestSupport masked this: its object referenced the FORMAT layer and so kept libOpenMS alive for every test. clang++, macOS and Windows were unaffected, which is why only the two g++ jobs failed. The link line is now: framework archive, libOpenMS, then (for the Arrow tests) the static Arrow/Parquet archives. That satisfies both ordering constraints at once -- verified: RAIICleanup_test links, and ConsensusMapArrowExport_test still has 0 Thrift symbols at 890 KB rather than 19.5 MB. 40 tests pass, including the 26 with explicit validation, the OpenSwathAlgo tests and TOPP_FuzzyDiff. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
Comments left over from developing this branch referred to intermediate states (the removed support library and its callbacks, includes that no longer exist). Reword them to state the current design, fix a comment that named OpenMS::absolutePath() instead of OpenMS::File::absolutePath(), and make the reason ClassTest.h's testTrue/testFalse must be inline precise (ClassTest.cpp in the archive is the second translation unit). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
- ClassTest.h: 2-space indent in isRealType(const ParamValue&) - FuzzyStringComparator.h: realign wrapped parameters left over from removing OPENMS_DLLAPI - Doxyfile_dot.in: drop the GENERATE_XML = YES assignment and its comment. It was overridden by GENERATE_XML = NO further down, so the comment claimed an XML output that this config never produced; the tools read the xml_output/ of the doc_xml target (Doxyfile_xml). Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
VALIDATE_TMP_FILES runs FileHandler::getType() on each temporary file and only schema-checks the types validateTmpFiles() has a case for; anything else is reported as skipped. PepXMLFile_test makes that visible: five of its six temporary files are pepXML and are skipped, and the macro earns its place there through the sixth, an idXML file that is validated. The previous wording implied every file written above gets checked. Same comment in all 26 tests, so it is updated in all of them. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
cmake_minimum_required said 3.21 while the Windows installation instructions and AGENTS.md both already stated 3.24, so this makes the build agree with the documentation rather than raising the bar on users. 3.24 is the first release with the $<LINK_LIBRARY:...> generator expression and user-defined link features (CMAKE_LINK_LIBRARY_USING_<FEATURE>). Those let a link requirement be stated directly -- for instance wrapping a library in --no-as-needed -- instead of encoding it in the order of target_link_libraries arguments, which is how the class tests currently keep libOpenMS alive ahead of the test-framework archive. Verified: configures clean with no policy warnings, the test count is unchanged at 2732, and nothing recompiles, so CMP0128 does not alter the language-standard flags. CMP0135, the notable new policy in 3.24, only affects URL-based downloads and every FetchContent_Declare here uses GIT_REPOSITORY. The subdirectory CMakeLists.txt files that still declare 3.15 are left alone: raising them would switch policy defaults in those scopes and deserves its own change. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
…gument order The class tests kept libOpenMS on the link line only because libOpenMSTestFramework.a -- which references Exception, StringUtils and UniqueIdGenerator -- happened to be listed first: with the linker's default --as-needed, a test whose own object needs nothing from libOpenMS (RAIICleanup_test) would otherwise drop it. That made the order of target_link_libraries() arguments a silent correctness requirement that only a comment protected. A 'needed' link feature (CMake 3.24) now says it outright, wrapping just libOpenMS in --push-state,--no-as-needed,...,--pop-state. Verified by reversing the arguments so libOpenMS comes first: it still links and still records libOpenMS.so as DT_NEEDED, while the same reversed order without the feature fails on exactly those undefined references. On Apple and Windows, which have no --as-needed, the feature passes the library through unchanged. The second requirement -- libOpenMS ahead of the static Arrow/Parquet archives, so their objects and Thrift's statics are not pulled into each test -- is unaffected and still documented. Checked in the clang Release build with static Arrow that reproduces it: ConsensusMapArrowExport_test is 890872 bytes with 0 Thrift symbols, matching the healthy baseline. The openms_gui tests keep the ordering for now: converting them means resolving how OpenMS is spelt inside OpenMS_GUI_LIBRARIES, which needs a Qt build to verify. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
Completes the previous commit: the openms_gui tests were left on the argument ordering because verifying a change there needs a Qt build. OpenMS_GUI_LIBRARIES is 'OpenMS_GUI;OpenMS;Qt6::Gui;Qt6::Widgets; Qt6::Svg;Qt6::OpenGLWidgets', so dropping OpenMS from that list and linking it through the feature is not sufficient on its own: OpenMS_GUI links OpenMS publicly, so OpenMS also reaches these targets as a transitive dependency with no feature, and CMake rejects that as 'OpenMS', specified without any feature or 'DEFAULT' feature, has already occurred with the feature 'needed', which is not allowed. LINK_LIBRARY_OVERRIDE_OpenMS settles the feature for every path by which OpenMS reaches the target, which is what that property exists for. Verified with Qt 6.4.2: configuration succeeds and the generated link line wraps libOpenMS in --push-state,--no-as-needed,...,--pop-state even though it now follows libOpenMS_GUI.so. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
Restores state that was carried by the merge commit which the split of the tooling-removal PR rebased away. UniqueIdGenerator stopped using boost::random in #9921, so the framework no longer needs Boost's include directories: the header it seeds from pulls in no boost headers at all any more. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR
e833176 to
d21ef5c
Compare
Follow-up: what it would take for the framework to stop depending on libOpenMSThis PR gets The concrete goal is a single pass/fail test:
How Catch2 solves this, and what carries overCatch2, GoogleTest and doctest depend on the standard library and nothing else. They sit at the bottom of the dependency graph, so there is no "library under test" to be coupled to. Where they do need to know something about a user's types, they never name them — the user registers the knowledge: CATCH_TRANSLATE_EXCEPTION(MyType const& ex) { return ex.message(); }Catch2 stores that in a static registry (added in 2.8.0, precisely because exceptions not deriving from We can't be std-only —
Measurement 1: nothing can be moved, and nothing is left to moveThe framework needs 7 utilities from libOpenMS. Every one is a core library facility, so relocating them into the framework is not available:
The reverse direction is also exhausted: scanning every That leaves duplicating those utilities as the only way to cut the dependency — which is the wrong trade for code the library uses in 285 places. So the mechanism has to be something else. Measurement 2: the closure is small and closedThe include closure of what the framework actually needs does not reach outside itself, apart from the generated config headers:
8 headers, 5 sources, ~1,150 lines — extractable as a core library that both libOpenMS and Consumers are unaffected: include paths stay as they are and libOpenMS What that removes from the problemThree things I had assumed were needed turn out not to be:
What remainsOne customization point, for the only dependency that should not go in the core. inline bool isRealType(const ParamValue&) { return true; }
inline bool isRealType(const DataValue&) { return true; }Replacing them with a trait the OpenMS side specializes is the direct analogue of template <class T> struct IsRealType : std::is_floating_point<T> {};Cost, measured: 26 test files need an explicit include they currently get transitively through Suggested order
Step 1 is not a precursor to splitting libOpenMS — it is the first slice of it. The framework's dependency list turns out to be a fairly precise specification of what the core library has to contain, which seems like the more useful outcome of this exercise. Happy to move this to an issue if that is a better home than a PR comment. Generated by Claude Code |
|
what are the compile time implications here? And how much does runtime increase with |
|
The validation already happened automatically. this just makes it explicit (removes the validation from the framework and moves it to the library to be tested). It is so small that compile times and linking is about the same as before. Rebuild will be smaller if we do a library split into core, up etc. The ultimate goal should be to get a proper inversion of the dependency (e.g. the testing framework should not know much about what it tests and thus works with split libraries). That’s how other testing frameworks do it. |
…raction Six pre-work changes, each measured on the #9919 branch, that remove the plan's hard parts at the root instead of working around them: configuration-free bottom layer with checked-in platform/export headers (deletes the config.h wiring section), pull-model terminate handler so Exception.cpp drops GlobalExceptionHandler (also fixes a data race), local PID fetch so SysInfo stays in libOpenMS, moving DataValue knowledge out of Types.h/StringUtils (incl. the test-only writtenDigits<DataValue> specialization and the dead OpenMS_locale global), finishing target-based CMake, and deriving the shipped-library roster. With S1-S4 landed, the extraction becomes 9 headers + 4 dependency-free sources - the "build-system only" move the original sketch assumed. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D
The follow-up sketch, verified and turned into a planThe sketch above has now been checked against this branch and expanded into a full implementation plan: Confirmed
Corrected: the closure is bigger than the header walk showedThe sketch measured header includes; the implementations add more:
So "8 headers, 5 sources, build-system only" is false as measured: 11 headers + 7 sources (~4,400 lines) and a handful of real source edits. The decision the sketch didn't make: the core must be a shared libraryA static core embedded in both libOpenMS and each test executable duplicates four load-bearing globals: the The better outcome: change the code so the sketch becomes trueEach hard part of the extraction exists because something in OpenMS sits one layer below where it belongs — and each is fixable by deleting code, as small independently green PRs before the extraction:
After 1–4, the extraction is 9 headers + 4 dependency-free sources — effectively the " @cbielow re compile time: net −1 TU (−2 after the cleanups: Generated by Claude Code |
Revision: the framework can be freed without creating a library (the Catch2 answer)The plan comment above was still complex because it answered two questions at once: free the test framework and start splitting libOpenMS. Everything heavy in it — the shared Catch2's cleanliness is one structural rule, not general tidiness:
The earlier sketch's objection ("we can't be std-only — Mapping the five measured couplings onto Catch2's mechanisms:
Result: Honest costs: ~250 lines duplicated in spirit (
Full write-up (measurements, trade-offs, sequencing) is Part 3 of Generated by Claude Code |
…a donor The spec no longer requires #9919 to merge. Sequencing std-only BEFORE extraction restructures the program into three green PRs from develop: PR0 explicit tmp-file validation (26 measured tests, hunks donated by the #9919 branch), PR1 std-only in place (framework files still inside libOpenMS, so tests keep linking as today), PR2 a purely mechanical move to src/testframework. Because the framework archive then references no libOpenMS symbols and every openms test binary references libOpenMS through the seeding/translator support TU, four pieces of #9919's machinery are never needed: the 'needed' link feature, LINK_LIBRARY_OVERRIDE, the CMake 3.21->3.24 bump, and the OpenMS->framework usage-requirement propagation; the Arrow/Thrift link order from develop is undisturbed. All file:line references re-verified against develop (c77f588), including develop-only deps the previous revision could not see (automatic FORMAT validation, TextFile/File use in FuzzyStringComparator, vestigial boost fpclassify include). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D
Note: this PR will be supersededThe plan has moved to a program based directly on Nothing here is wasted — this branch becomes the donor for its verified pieces: the What the new sequencing avoids needing at all: the Keeping this PR open until the replacement PRs are up, then it will be closed in favor of them. Generated by Claude Code |
END_TEST no longer schema-validates NEW_TMP_FILE outputs automatically; the 26 tests that actually validated files (determined by measurement in #9919: all 57 NEW_TMP_FILE+XML tests were run against the automatic- validation build and 26 validated something) now call VALIDATE_TMP_FILES explicitly via the new header-only TestFileValidation.h in the class-test project. Each validates exactly the same files as before; types without a schema validator were skipped before and still are. This removes the framework's only dependency on the FORMAT layer (a CONCEPT component calling upward), as prework for making the class-test framework standard-library-only. Validation becomes opt-in for new tests; the VALIDATE_TMP_FILES docs say when to add it. Validation hunks taken from #9919 (measurement and 26-test list). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D
…on.h) The donor hunk from #9919 that puts ${PROJECT_SOURCE_DIR}/include/ on the class-test include path was missed when porting the explicit- validation commit; without it the 26 validating tests cannot find <OpenMS/TestFileValidation.h>. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D
|
Quick question, what do we do that catch cannot do? |
|
I think we could move to catch2 but: we would not win much as you also need to register exception translators and catch is a bit more expensive regarding compile times. See the new PR with the improved design. |
|
#9929 With improved / low dependency design |
|
@jpfeuffer v3 seems to have faster build times so catch2 could be a follow up at some point |
…to its own library (OpenMSTestFramework) (#9929) * [DOC] Plan: OpenMSCore extraction so the test framework stops depending on libOpenMS Follow-up plan for #9919, verified against that branch by measurement: the framework's link surface (nm on its two objects), the implementation closure the PR-comment sketch missed (GlobalExceptionHandler, SysInfo, SIMDe, the DataValue/ParamValue toStr definitions), why the core must be a shared library (four duplicated-state hazards incl. UniqueIdGenerator seeding and BaseException RTTI), the OPENMSCORE_DLLAPI/config.h wiring, the test-side isRealType customization point (26+1 files, measured), the two-PR step sequence with an acid test, and the packaging checklist for a new shipped library (wheels, KNIME, pyOpenMS preload). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [DOC] Part 2: upstream simplifications that shrink the OpenMSCore extraction Six pre-work changes, each measured on the #9919 branch, that remove the plan's hard parts at the root instead of working around them: configuration-free bottom layer with checked-in platform/export headers (deletes the config.h wiring section), pull-model terminate handler so Exception.cpp drops GlobalExceptionHandler (also fixes a data race), local PID fetch so SysInfo stays in libOpenMS, moving DataValue knowledge out of Types.h/StringUtils (incl. the test-only writtenDigits<DataValue> specialization and the dead OpenMS_locale global), finishing target-based CMake, and deriving the shipped-library roster. With S1-S4 landed, the extraction becomes 9 headers + 4 dependency-free sources - the "build-system only" move the original sketch assumed. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [DOC] Part 3: the Catch2 answer - free the framework without creating a library Parts 1-2 answered two questions at once; all residual complexity (shared library, export macros, config wiring, packaging, ABI) belongs to starting the libOpenMS split, not to freeing the framework. Catch2's structural rule - the framework's compiled code touches only std types, everything type-specific happens at the macro-expansion site - maps onto the five measured couplings: expansion-site printing already works today, BaseException already derives std::runtime_error (complete what(), catch std::exception), framework-owned trim/extractDouble/ formatter (~250 lines, loud failure mode), seeding via a test-project support TU, and the S4 predicate. Result: a std-only static framework, no new shipped artifact, acid test met in three small PRs; OpenMSCore decouples onto the split's own timeline. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [DOC] Implementer spec for the std-only test framework (Part 3 handoff) File-by-file specification with copy sources (appendNumeric, extractDouble+parseFloat/tryParseNaN, to_path), the exception-translator registry replacing the BaseException clauses in printLastException and the TEST_EXCEPTION* macros, the seeding+translator support TU wired into the three add_executable sites, the printValue layer (named function, not operator<<, to avoid ADL ambiguity with ListUtilsIO), framework-owned writtenDigits (OpenSwathAlgo tests use TEST_REAL_SIMILAR), the NDEBUG switch for the precondition macros (14 files), the include-fallout protocol, acceptance criteria, and a risk register. Two revisions to Part 3 discovered while specifying: the isRealType predicate must ride in the main PR (ClassTest.h cannot go std-only while including DataValue.h), and the what()-completion PR is dropped -- 29 files compare what() verbatim in TEST_EXCEPTION_WITH_MESSAGE, so exception naming is injected via a registered translator instead. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [DOC] Rebase the std-only framework spec onto develop; #9919 becomes a donor The spec no longer requires #9919 to merge. Sequencing std-only BEFORE extraction restructures the program into three green PRs from develop: PR0 explicit tmp-file validation (26 measured tests, hunks donated by the #9919 branch), PR1 std-only in place (framework files still inside libOpenMS, so tests keep linking as today), PR2 a purely mechanical move to src/testframework. Because the framework archive then references no libOpenMS symbols and every openms test binary references libOpenMS through the seeding/translator support TU, four pieces of #9919's machinery are never needed: the 'needed' link feature, LINK_LIBRARY_OVERRIDE, the CMake 3.21->3.24 bump, and the OpenMS->framework usage-requirement propagation; the Arrow/Thrift link order from develop is undisturbed. All file:line references re-verified against develop (c77f588), including develop-only deps the previous revision could not see (automatic FORMAT validation, TextFile/File use in FuzzyStringComparator, vestigial boost fpclassify include). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [TEST] Make tmp-file schema validation explicit (VALIDATE_TMP_FILES) END_TEST no longer schema-validates NEW_TMP_FILE outputs automatically; the 26 tests that actually validated files (determined by measurement in #9919: all 57 NEW_TMP_FILE+XML tests were run against the automatic- validation build and 26 validated something) now call VALIDATE_TMP_FILES explicitly via the new header-only TestFileValidation.h in the class-test project. Each validates exactly the same files as before; types without a schema validator were skipped before and still are. This removes the framework's only dependency on the FORMAT layer (a CONCEPT component calling upward), as prework for making the class-test framework standard-library-only. Validation becomes opt-in for new tests; the VALIDATE_TMP_FILES docs say when to add it. Validation hunks taken from #9919 (measurement and 26-test list). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [INTERNAL] Class-test framework: standard library only The framework (ClassTest, FuzzyStringComparator) no longer uses anything from libOpenMS -- verified by compiling both TUs against an include tree containing only the framework's own headers, and by linking and running a test executable against nothing but the two framework objects. Following the structure of Catch2: the framework's compiled code touches only std types; everything type-specific happens at the macro-expansion site or is registered by the side that knows. * New ClassTestUtils.h owns the utilities the framework needs: writtenDigits, an isRealType predicate (floating point, or class implicitly convertible to double -- covers DataValue/ParamValue and any future variant type with zero registration), the numeric formatter (verbatim copy of StringUtils' appendNumeric; TEST_EQUAL's string-vs-number quirk must format exactly like toStr), a printValue layer for failure reports (streamable via expansion-site operator<<, ranges as "[a, b, c]" like ListUtilsIO, placeholder otherwise), trim/ split/join, and a precisionWrapper equivalent. * Exception handling: the framework catches std::exception only. TEST_EXCEPTION's typed catch always bound in the test TU; the hard-coded BaseException clauses are replaced by registered exception translators (Catch2's translator design). printLastException and the macros describe foreign exceptions via describeCaughtException(). * FuzzyStringComparator carries local copies of extractDouble/ tryParseNaN/parseFloat, to_path, prefix/suffix and TextFile::getLine (each with a pointer to its source of truth); StringList/Int/UInt are respelled as their underlying std types, so the API is unchanged and FuzzyDiff compiles as before. * New OpenMSTestSupport.cpp, compiled into every openms/openms_gui test executable, seeds UniqueIdGenerator at static init (earlier than the removed START_TEST-time call) and registers the OpenMS exception translator. OpenSwathAlgo tests do not include it -- their tests need nothing from libOpenMS anymore. * TEST_PRECONDITION/POSTCONDITION_VIOLATED now key on NDEBUG (also correct for multi-config generators, unlike CMAKE_BUILD_TYPE). * 25 tests add the DataValue/ParamValue includes they previously got transitively through ClassTest.h (23 + 3, measured; one file needs both). The framework files still live in src/openms and still compile into libOpenMS; the move into their own static library is the next commit. Test link lines are unchanged in this commit. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [BUILD,INTERNAL] Move the class-test framework into its own library (OpenMSTestFramework) Pure mechanics on top of the previous commit: git mv of the six framework files (history follows) out of libOpenMS into src/testframework/, built as the static library OpenMSTestFramework. Include paths are unchanged (<OpenMS/CONCEPT/ClassTest.h>), install locations are unchanged, so no test file needs editing for the move. Because the framework is standard-library-only, none of the link-order machinery a dependent framework would need exists here: no link features, no --as-needed precautions, no usage-requirement propagation from OpenMS, and the CMake minimum stays at 3.21. Every openms / openms_gui test binary references libOpenMS genuinely (through its own test code and OpenMSTestSupport.cpp), and libOpenMS.so keeps preceding the static Arrow archives on the test link lines exactly as on develop. * class tests link "OpenMSTestFramework ${OpenMS_LIBRARIES}" (gui analogous); the OpenSwathAlgo tests link "OpenSwathAlgo OpenMSTestFramework" -- no libOpenMS anywhere in their link closure, which was the goal of this series. * FuzzyDiff links the framework for FuzzyStringComparator. * The ~50 OPENMS_DLLAPI decorations are stripped (a static archive exports nothing) and the framework's symbols leave the libOpenMS ABI. * The archive installs under its own component and is deliberately not part of the exported OpenMS package, so minimal component-wise install flows (pyOpenMS wheels) are unaffected. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [INTERNAL] Remove test-only DataValue knowledge from Types.h and the OpenMS_locale relic The writtenDigits<DataValue> specialization (and its DataValue forward declaration) existed only for TEST_REAL_SIMILAR, which now uses the test framework's own writtenDigits; no library code calls it (measured). Internal::OpenMS_locale was a no-op: its initializer saved the locale, set "C" and restored the saved locale again, so the global only ever held the literal "C". Its one reader (OpenSwathFeatureXMLToTSV) now uses the literal; the test that existed solely to verify the relic is removed, and with it Types.cpp is empty and deleted. This also removes a static-initialization side effect from the bottom-most library layer. Plus the CHANGELOG entry for the whole test-framework series. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [TEST] Add includes tests previously received transitively via ClassTest.h First batch of the include fallout from the framework going standard-library-only: tests using Exception types, StringUtils' string operators, or the StringList alias now include those headers themselves. Found by the full local build; more batches follow as the -k 0 pass surfaces them. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [TEST] Second batch of include fallout; make MultiplexSatelliteProfile.h self-contained Complete inventory from the full -k 0 build: tests add the Types.h / Exception.h / StringUtils.h / TypeAliases.h includes they previously received transitively through ClassTest.h. Two notable finds beyond plain includes: MultiplexSatelliteProfile.h used OPENMS_DLLAPI without including OpenMSConfig.h (never self-contained; papered over by the old ClassTest.h transitives) and gets the include; and the one TEST_EQUAL(std::string, DataValue) call site in the tree (TargetedSpectraExtractor_test) now stringifies explicitly with DataValue::toString() -- the same function the removed implicit toStr(DataValue) path called. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [TEST] Add the class-test project's own include dir (TestFileValidation.h) The donor hunk from #9919 that puts ${PROJECT_SOURCE_DIR}/include/ on the class-test include path was missed when porting the explicit- validation commit; without it the 26 validating tests cannot find <OpenMS/TestFileValidation.h>. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [TEST] TOPPBase_test: compare string options against string literals The five TEST_EQUAL(getStringOption(...), DataValue("...")) sites compared a std::string against a DataValue, which relied on the framework stringifying the DataValue; comparing against the string literal directly is equivalent and simpler. (The framework's stringification guard rejects non-arithmetic types by design.) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [TEST] Key TEST_PRECONDITION_VIOLATED on the library's OPENMS_ASSERTIONS via registration The NDEBUG guard was wrong in exactly the configuration the class tests build in: the test projects replace CMAKE_CXX_FLAGS_RELEASE with plain -O0, wiping -DNDEBUG, so the macros expected Precondition throws from a Release library whose OPENMS_PRECONDITION checks are compiled out -- nine "no exception thrown" failures and one segfault (the unguarded command running into the very condition the precondition guards) in the local Release run. Fixed with the same pattern as seeding and exception naming: the side that knows registers. TEST_PRECONDITION/POSTCONDITION_VIOLATED now check a runtime flag (default off) that OpenMSTestSupport.cpp enables under #ifdef OPENMS_ASSERTIONS -- the identical switch Macros.h keys the library's checks on, read from the same config.h, so the expectation can never diverge from the library's behavior in any build type, flag override, or multi-config generator. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [INTERNAL] Address review: iterator-overload UB, libc++ includes, report wording, doc alignment Review findings from #9929, each verified against the code before fixing: * extractDouble/extractInt iterator overloads (StringUtils.h and the framework's copy, kept in sync) no longer dereference the past-the-end iterator -- the end pointer is computed from the range length -- and guard empty ranges before dereferencing begin. Identical behavior for non-empty ranges; debug-iterator builds stop asserting. * FuzzyStringComparator: explicit <fstream>/<istream>/<ostream> in the header and <type_traits> in the .cpp (std::is_same_v sits in the libc++-only from_chars fallback, exactly the platform that would have missed it transitively). * TEST_NOT_EQUAL's generic failure branch says "forbidden is" like its enum branch (the "expected" wording predates this series). * describeCaughtException() documents that it requires an active exception (bare rethrow otherwise terminates). * TestFileValidation.h includes Types.h/TypeAliases.h directly and VALIDATE_TMP_FILES prints the failing-line marker like VALIDATE_FILE. * OpenSwathFeatureXMLToTSV: setlocale(LC_ALL, "C") directly instead of a variable that only ever held "C". * doc/plans: Part 3 aligned with the implemented translator design (no what() changes), PR count wording, acceptance criterion checks the transitive closure via ldd, include check scans all framework files against an allowlist. Declined, with reasons in the PR thread: the to_path POSIX fallback (verbatim copy of PathUtils.h; POSIX path construction is a byte copy and cannot throw) and registering compressed tmp-file names (behavior is identical to develop's automatic validation; changing it would newly validate files with unverified .gz validator support -- follow-up material). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [DOC] ClassTest doxygen page: document the std-only framework architecture Rewrite the @defgroup ClassTest page (stale since the framework moved out of OpenMS/source/TEST): what the OpenMSTestFramework library is, why it is std-only, test anatomy, the registration points wired up by OpenMSTestSupport.cpp (exception translators, precondition-test enablement, unique-id seeding), expansion-site printing, the TEST_REAL_SIMILAR convertibility rule, and where VALIDATE_TMP_FILES lives. Tag VALIDATE_TMP_FILES / VALIDATE_FILE / validateTmpFiles with @InGroup ClassTest and add the openms class-test include dir to the documentation search path so they render on the same page. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [DOC] ClassTest: use doxygen comments for the group markers The member block of the ClassTest topic was delimited with plain '//@{' / '//@}' C++ comments, which doxygen (1.9.x) ignores entirely -- the generated 'Class test macros' page carried the group description but listed no macros. Replace them with real doxygen comments ('/** @{ */' ... '/** @} */') so all test macros appear as members of the page, and drop the equally invisible '//@name test and subtest' stub. Verified with doxygen 1.9.8: the group page now lists all 26 framework macros plus the validation helpers. Also escape the whitespace escapes in the trim() doc comment, which doxygen parsed as (unknown) commands. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [DOC] Drop the design/plan documents from the branch The two planning documents under doc/plans/ drove the design phase of this series; the durable outcome lives in the PR description, the code comments, and the ClassTest doxygen page. Remove them so the tree gains no implementation-time planning artifacts. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [FIX] to_path: key the Windows fallback on _WIN32; review-round polish PathUtils.h guarded the Windows ANSI-code-page fallback of the inline to_path() with OPENMS_WINDOWSPLATFORM but includes nothing that defines it, so the branch selected depended on whether the including TU happened to see <OpenMS/config.h> first -- an ODR hazard, and the cause of the windows-2025 CI failure: the std-only ClassTest.h no longer hands test TUs config.h transitively, so PathUtils_test compiled to_path without the fallback and the CP-1252 test cases threw. Key the guard on the compiler-provided _WIN32 (self-contained by construction; matches the framework's copies byte for byte). Verified as the only header using a config.h macro without including config.h; all test TUs using such macros reach config.h via Types.h. Review-round follow-ups: printLastException reproduces develop's exact two-line report format for non-OpenMS exceptions (translator output stays on one line); drop TOPPBase_test's now-unused DataValue.h include; document writtenDigits' deliberate report-precision divergence (ParamValue 6->15, long 9->18; print-only, never the comparison). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [BUILD] Do not ship the test-framework archive The class-test framework is an in-repo development tool, not product payload. Mark the archive's install rule EXCLUDE_FROM_ALL so default installs and the monolithic installers (NSIS/zip) skip it, and drop the component from the macOS productbuild package list (which enumerates components explicitly). `cmake --install . --component OpenMSTestFramework` still installs it for whoever wants it. The headers keep installing to their historic location: they always shipped as part of the OpenMS header set, and existing includes of <OpenMS/CONCEPT/ClassTest.h> keep resolving against an installed tree. All linking consumers (class tests, FuzzyDiff, tests of future split-off libraries) are in-tree and use the CMake target directly. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D * [TEST] Guard the framework's copies of the libOpenMS numeric code OpenMSTestFramework is standard-library-only, so the numeric formatting and number parsing it needs are copies of libOpenMS code: detail::appendNumeric in ClassTestUtils.h from StringUtils.cpp, and tryParseNaN/fromCharsFloat/ parseFloat/extractDouble in FuzzyStringComparator.cpp from StringUtils. The copies exist to produce identical results, and nothing enforced that. The two sides compile independently, so a change to one was silently accepted, and the consequence would not be a build error but a behavioural one: TEST_EQUAL (std::string, <number>) would stop agreeing with StringUtils::toStr(), and FuzzyStringComparator would stop reading back the numbers the library writes into the TOPP reference files. The suite was only an indirect oracle for this -- it notices drift when some unrelated test's expected string happens to change. The test compares against libOpenMS rather than against a table of expected strings, so a legitimate change to the library's format does not have to be transcribed here, and the assertion keeps meaning "the two agree". It sits in the class-test project because only there are both implementations visible. Covers double/float/long double/integral formatting, writtenDigits (pinning the documented, deliberate long and unsigned long divergences so they stay deliberate), and -- through compareStrings -- that the comparator still parses what StringUtils writes. Verified by mutation: dropping one digit of precision in the framework's appendNumeric, making its extractDouble always fail, and making its parseFloat reject exponents are each caught. Disabling tryParseNaN alone is not, since std::from_chars accepts "nan" as well; the comment on that assertion says so rather than claiming a guard it does not provide. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MbuL7ckNAxytCK486pxHGR * [DOC] Trim verbose code comments in the test framework Tighten the block/rationale comments added in this series (framework CMakeLists, ClassTestUtils, OpenMSTestSupport, PathUtils, FuzzyStringComparator, TestFileValidation, packaging) to the load-bearing facts; no code changes. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014EBe4MJ3TQJxm4GVm4N42D --------- Co-authored-by: Claude Fable 5 <[email protected]>
Description
Extracts the class-test framework from libOpenMS into a standalone static library, as prework for splitting libOpenMS into smaller libraries. Today every test of every library — including
OpenSwathAlgo's — has to link all of libOpenMS just to get theTEST_*macros; after this change the framework stands on its own.No test file changes are required by the move: the headers keep their install paths, so
#include <OpenMS/CONCEPT/ClassTest.h>works unchanged in all ~720 tests.What moves
ClassTest.h/.cpp,FuzzyStringComparator.h/.cppandMacrosTest.hmove tosrc/testframework/and are built as the static libraryOpenMSTestFramework(git mv, so history follows).Static is deliberate: the framework is per-executable global state, so there is nothing to share between processes, no new runtime artifact ships, and no
OPENMS_DLLAPIdecorations are needed. Its ~55 symbols are consequently no longer exported from libOpenMS.Breaking the dependency on the upper layers
The framework previously called into the FORMAT layer — a
CONCEPTcomponent depending onFORMAT, which is backwards, and the reason it could not be separated. Two pieces of behavior were involved:NEW_TMP_FILEoutput atEND_TEST<OpenMS/TestFileValidation.h>in the class-test project; tests callVALIDATE_TMP_FILES(orVALIDATE_FILE(f)) explicitlyUniqueIdGeneratorseeding atSTART_TESTUniqueIdGeneratorisCONCEPTlevel, the same layer the framework already uses forStringUtils/ExceptionThe result has no callbacks and no support library.
OpenMSTestFramework's only external symbols are ten from libOpenMS'sCONCEPT/DATASTRUCTURESlayers (Exception,StringUtils,UniqueIdGenerator) and it needs no third-party headers at all — so when libOpenMS is split, its dependency simply becomes the future core library.Which tests need the explicit validation call was determined by measurement, not inspection: all 57 tests combining
NEW_TMP_FILEwith a validatable format were built and run against the previous automatic-validation build to record what each actually validated. 26 validate files and got the call; the other 31 produce nothing validatable. Each of the 26 validates exactly the same files as before — note that files whose type has no schema validator (e.g. pepXML) were skipped before this PR too, and still are.Note this makes validation opt-in: a new test that writes an XML file is not schema-checked unless its author adds
VALIDATE_TMP_FILES. The macro documents when to use it.Link requirements
Class-test executables link
OpenMSTestFramework, then libOpenMS, then (for the Arrow tests) the static Arrow/Parquet archives. Two distinct requirements are involved, and they are handled differently:1. libOpenMS must survive
--as-needed. The framework archive referencesException/StringUtils/UniqueIdGenerator, but a test whose own object references nothing from libOpenMS (e.g.RAIICleanup_test) would let the linker drop it. This used to depend on the order oftarget_link_librariesarguments, protected only by a comment. It is now stated outright with a user-defined link feature (cmake/compiler_flags.cmake):which wraps just libOpenMS in
--push-state,--no-as-needed,…,--pop-state. Verified by reversing the arguments so libOpenMS comes first: it still links and still recordslibOpenMS.soasDT_NEEDED, whereas the same reversed order without the feature fails on exactly those undefined references. On Apple and Windows, which have no--as-needed, the feature passes the library through unchanged.For the GUI tests,
OpenMS_GUIlinksOpenMSpublicly, so OpenMS also arrives transitively without a feature — which CMake rejects as a conflict.LINK_LIBRARY_OVERRIDE_OpenMSsettles the feature for every path by which OpenMS reaches the target.This is why the CMake minimum moves from 3.21 to 3.24, the first release with
$<LINK_LIBRARY:...>and user-defined link features. The Windows installation instructions andAGENTS.mdalready stated 3.24, so this only makescmake_minimum_requiredagree with them; Ubuntu 24.04 LTS ships 3.28.2. libOpenMS must precede the static Arrow/Parquet archives, or the linker resolves the Arrow symbols from those archives and pulls their objects — including Thrift's static enum tables — into each test binary, inflating it ~24× and duplicating static objects that libOpenMS already owns. Those duplicates were then destroyed twice at process exit, corrupting the heap. This one is still positional (appending keeps it true) and remains documented at the call site.
openms_hide_static_archive_symbols()(--exclude-libs,ALL, GNU ld/lld only) additionally keeps static-archive symbols out of test executables' dynamic tables, so duplicated statics cannot be interposed even if something is pulled in later.Also included
FuzzyDifflinks the framework (it wrapsFuzzyStringComparator); the ~1600 TOPP tests that use it are unaffected.AGENTS.md's style-check instructions pointed at atest_stylebuild target that does not exist in the build system.Testing
Green on all five CI platforms (ubuntu g++/clang++, ubuntu-arm g++, macOS, Windows) with the full suite, plus all four wheel builds and the 20 wheel-install jobs.
build-sphinxis red on this and every other open PR:ruff-actioninstalls an unpinned latest ruff that flags files underdoc/pyopenms/, which this branch does not touch.Locally verified in a clang Release build with static Arrow (the CI configuration):
ConsensusMapArrowExport_testis 890,872 bytes with 0 Thrift symbols, against 19.5 MB and 504 when the link order is wrong. The 26 validating tests, the OpenSwathAlgo tests,RAIICleanup_test,UniqueIdGenerator_testandTOPP_FuzzyDiffall pass.Checklist