feat(test): write lcov coverage reports
VoidBuildSystem CI / signing-openssl-gcc16 (push) Successful in 1m40s
VoidBuildSystem CI / fuzz-clang (push) Failing after 1m47s
VoidBuildSystem CI / sanitizers-gcc16 (push) Successful in 3m0s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 6m44s

This commit is contained in:
faumaray committed 2026-12-05 14:50:44 +03:00
1 parent d420732016
commit 92c4be9273
9 files changed
+326 -1

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
#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");
} // namespace Void::Build::Report