Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft/Runner/Runner.cpp
diff options
context:
space:
mode:
authorLeitwolf112026-11-13 21:55:26 +0300
committerLeitwolf112026-11-13 21:55:26 +0300
commit454cca9b63991416f4d9bd1ca350f1ae14e278e7 (patch)
treed85cafe2ee3ca7c5a8897a3e0fdde844fb18c6f6 /src/Progmasoft/Runner/Runner.cpp
parent55dab34729c14c9019b7062fccd11fc22372e805 (diff)
downloadcatch3-454cca9b63991416f4d9bd1ca350f1ae14e278e7.tar.gz
Fix the coverage review findings: branches, stale reports, exit status
- gcov is run with --branch-probabilities; without it the JSON has no branches, so GCC runs had none in coverage.json and coverage.lcov. - PrepareCoverageDirectory also removes coverage.json, coverage.lcov and coverage.profdata of an earlier run, so a run that writes no reports leaves none to be read as its own. - WriteCoverageReports returns notes and failures apart. A profile the tools cannot read or a report that cannot be written counts as a missing report and fails a run whose tests passed; no profiles or missing tools stay notes. The paths are announced only for the reports written. - ProfiledAttempt takes the last attempt whose profile exists, so a final retry or repeat that crashed before writing one no longer hides the coverage of the attempt before it. - The per-test llvm-profdata/llvm-cov and gcov runs use as many threads as the run had workers; results keep the order of the tests. Tests: earlier reports removed and no failure without profiles; an attempt without a profile gives way to an earlier one; the fixture gains a branch taken one way, checked in the combined LCOV for both LLVM and gcov. Amalgamation regenerated.
Diffstat (limited to 'src/Progmasoft/Runner/Runner.cpp')
-rw-r--r--src/Progmasoft/Runner/Runner.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Progmasoft/Runner/Runner.cpp b/src/Progmasoft/Runner/Runner.cpp
index 61f8f2b7..5667f65e 100644
--- a/src/Progmasoft/Runner/Runner.cpp
+++ b/src/Progmasoft/Runner/Runner.cpp
@@ -995,13 +995,25 @@ namespace Progmasoft::Catch3
run.tests.push_back(std::move(kept));
}
run.notes = std::move(outcome.notes);
+ bool coverageFailed = false;
if (!options.coverageDirectory.empty())
{
- for (auto &note : Runner::WriteCoverageReports(
- options.coverageDirectory, run, program.string()))
+ auto coverage
+ = Runner::WriteCoverageReports(options.coverageDirectory,
+ run,
+ program.string(),
+ run.workers);
+ for (auto &note : coverage.notes)
{
run.notes.push_back(std::move(note));
}
+ // Like a report that could not be written, a coverage
+ // failure makes the run fail when its tests passed.
+ coverageFailed = !coverage.failures.empty();
+ for (auto &failure : coverage.failures)
+ {
+ run.notes.push_back(std::move(failure));
+ }
}
const bool anyFailure
@@ -1023,7 +1035,8 @@ namespace Progmasoft::Catch3
Runner::Analyze(run, analysis);
console.RunEnded(run);
- const bool reportMissing = !WriteReports(options, run);
+ const bool reportMissing
+ = !WriteReports(options, run) || coverageFailed;
if (options.historyEnabled)
{
SaveHistory(historyFile,