coverage#
Configure (if needed) and generate a coverage report, check coverage against configured thresholds, or both.
clibra coverage --preset coverage --html # generate HTML report
clibra coverage --preset coverage --check # check thresholds
clibra coverage --preset coverage --html --open # generate and open in browser
clibra coverage --preset coverage --html --check # do both
Requires LIBRA_COVERAGE to be ON in the preset’s
CMake cache. At least one of --html or --check must be given;
running clibra coverage with neither is an error. The two may be
combined, in which case the report is generated first and the check runs
after.
--open opens the generated index.html in the system browser after
a successful --html run (ignored under --dry-run).
Note
Unlike most other subcommands, clibra coverage reconfigures only
when --reconfigure is passed. --fresh selects a fresh
reconfigure but has no effect on its own — pair it with
--reconfigure.
CMake equivalent#
clibra coverage --html discovers the first available HTML-generating
target from the ordered list [gcovr-report, llvm-report] by querying
target availability. --check uses gcovr-check directly.
# HTML report (gcovr)
cmake --build --preset <name> --target gcovr-report
# HTML report (llvm-cov, used if gcovr-report unavailable)
cmake --build --preset <name> --target llvm-report
# Threshold check
cmake --build --preset <name> --target gcovr-check
Coverage thresholds are configured via LIBRA_GCOVR_LINES_THRESH,
LIBRA_GCOVR_FUNCTIONS_THRESH,
LIBRA_GCOVR_BRANCHES_THRESH, and
LIBRA_GCOVR_DECISIONS_THRESH. See
Analysis and formatting targets for the full target reference.
Flag reference#
clibra coverage#
Configure (if needed) and generate a coverage report/check coverage.
Fails if neither of those operations are possible. Requires LIBRA_COVERAGE=ON in the preset’s CMake cache. The preset defaults to coverage if not given.
Usage: clibra coverage [OPTIONS]
Options:#
--html— Generate HTML report.Tries gcovr and LLVM-based generation in order.
--check— Check code coverage with gcovr--open— Open the HTML report in the system browser after generation-D <VAR=VALUE>-r,--reconfigure— Force the configure step even if the build directory exists-f,--fresh— Reconfigure with a –fresh cmake build directory