feat(test): write lcov coverage reports
This commit is contained in:
1 parent
d420732016
commit
92c4be9273
9 files changed
+326
-1
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user