Files
Build-System/include/Void/Build/Report/Coverage.hpp
T
faumaray 455a403429
VoidBuildSystem CI / 1 · Requirements (push) Successful in 3s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m1s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m25s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 4m9s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 2m6s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m47s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m58s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m23s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 24s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 30s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m24s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m27s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m39s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
feat(test): doctests, sharding, coverage gates, rerun/flaky and fuzzing (G8)
- vbs doctest extracts fenced C++ blocks from ///, //! and Doxygen comments,
  compiles each as main() with #line diagnostics mapped to the header,
  links optional --source files and reports per-block pass/fail.
- vbs test --shard I/N clusters tests with their fixture prerequisites and
  greedily balances clusters using the previous run's timings
  (<build>/.vbs/test_timings.json, written after every run).
- --rerun-failed re-runs only the previously failed closure
  (<build>/.vbs/last_failed_tests.json); --known-flaky FILE reports flaky
  failures without failing the run.
- --coverage-min PCT and --coverage-diff BASE enforce coverage gates from
  the lcov report (summary comparison via Report::read_lcov_summary).
- vbs fuzz compiles a libFuzzer target with clang
  (-fsanitize=fuzzer,address,undefined), runs it over a corpus and reports
  crash artifacts.

Verified: doctest_extracts_compiles_and_runs_blocks,
test_sharding_partitions_tests_and_records_timings,
test_rerun_failed_and_known_flaky,
coverage_gates_enforce_minimum_and_baseline and
fuzz_builds_targets_and_reports_crashes pass; CLI contracts pass;
clang-format clean.
2026-12-06 20:21:51 +03:00

39 lines
1.4 KiB
C++

#pragma once
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <cstddef>
#include <filesystem>
#include <string>
#include <vector>
namespace Void::Build::Report {
struct CoverageSummary {
std::size_t files{0};
std::size_t lines_found{0};
std::size_t lines_hit{0};
};
// Every `.gcda` profile data file under `root` (e.g. a profile build directory).
[[nodiscard]] std::vector<std::filesystem::path>
collect_gcda_files(const std::filesystem::path &root);
// Converts gcov data into `output_dir/coverage.info` (lcov) and `output_dir/summary.txt`.
// Requires the `gcov` executable (part of the GCC/Clang toolchain); when `source_root` is
// non-empty only sources below it are reported (system headers are dropped).
[[nodiscard]] Void::Result::Result<CoverageSummary, Void::Result::Error>
write_coverage_report(const std::vector<std::filesystem::path> &gcda_files,
const std::filesystem::path &output_dir,
const std::filesystem::path &source_root = {},
const std::string &gcov_executable = "gcov");
// Reads the LF/LH totals from an lcov file (used for coverage gates and diffs).
[[nodiscard]] Void::Result::Result<CoverageSummary, Void::Result::Error>
read_lcov_summary(const std::filesystem::path &lcov_file);
[[nodiscard]] double coverage_percent(const CoverageSummary &summary) noexcept;
} // namespace Void::Build::Report