test(coverage): a reproducible coverage preset, report and floor check

This commit is contained in:
Martino Ferrari committed 2026-09-28 21:23:22 +02:00
1 parent 41b79313a7
commit e9985eeeaf
6 files changed
+603

No files matched your search

+18
View File
@@ -123,6 +123,24 @@ if(PLOT_BUILD_TESTS)
add_subdirectory(tests)
endif()
# The reproducible coverage report. A custom target rather than a ctest case,
# for two reasons: a ctest entry registered in the coverage preset would either
# fail in a freshly configured tree (no report exists until tools/coverage.sh
# has run once, which would break the plain `ctest --test-dir build/cov` the
# preset's own documentation promises) or it would have to build the library
# and re-run the whole suite inside the test, duplicating the script. A target
# that is not part of `all` costs the ordinary presets nothing -- and it is not
# even created there, because PLOT_COVERAGE is off and the option's guard
# rejects a tree that carries no --coverage flags. The exact command a reader
# gets is `cmake --build build/cov --target coverage`, which is the same one
# tools/coverage.sh implements.
if(PLOT_COVERAGE)
add_custom_target(coverage
COMMAND "${CMAKE_SOURCE_DIR}/tools/coverage.sh" "${CMAKE_BINARY_DIR}"
COMMENT "coverage: building, running the suite, capturing src/** and enforcing the floor"
USES_TERMINAL VERBATIM)
endif()
# Install and export. The core always goes in; each adapter joins the set only if
# its toolkit can be re-found on a consumer's machine, which the adapter decided
# when it was added (plot_record_adapter_export() -- the decisions and the reasons