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
@@ -20,6 +20,24 @@ option(PLOT_INSTALL "Generate install and export rules (find_package(plot))" ON)
set(PLOT_SANITIZE "" CACHE STRING
"Sanitizers to build with, as the list a -fsanitize= flag takes (e.g. address); empty for none")
# The reproducible coverage report lives in tools/coverage.sh, and its `coverage`
# CMake target is offered only in a tree that is actually instrumented -- the
# target re-runs the capture, and a report over an uninstrumented build is a
# lie with numbers in it. The linux-coverage preset sets this; the other three
# presets leave it off, so their target lists, configure time and build product
# are exactly what they were before this option existed.
option(PLOT_COVERAGE "Add the `coverage` target (needs a --coverage build tree)" OFF)
if(PLOT_COVERAGE AND NOT CMAKE_CXX_FLAGS MATCHES "--coverage")
message(FATAL_ERROR
"plot: PLOT_COVERAGE=ON needs a --coverage build (CMAKE_CXX_FLAGS is \"${CMAKE_CXX_FLAGS}\"). "
"Configure with --preset linux-coverage, or drop -DPLOT_COVERAGE=ON.")
endif()
if(PLOT_COVERAGE AND NOT PLOT_BUILD_TESTS)
message(FATAL_ERROR
"plot: PLOT_COVERAGE=ON needs PLOT_BUILD_TESTS=ON -- the coverage report measures what "
"the test suite executes, so a coverage tree with no suite has nothing to report.")
endif()
# Sanitizer flags go on every target in this project, fetched third-party sources
# included: a partially instrumented build reports as loudly about the
# instrumentation gap as about any real bug. The flags are one -fsanitize= list