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

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft/Runner/CoverageReport.cpp
diff options
context:
space:
mode:
authorLeitwolf112026-11-13 23:24:10 +0300
committerLeitwolf112026-11-13 23:24:10 +0300
commitb26486d68ece48a1dfdb208a9f3f1bd8acab0382 (patch)
treeaf0d8c583c22d61568ae250011b77cba6acc8c34 /src/Progmasoft/Runner/CoverageReport.cpp
parent454cca9b63991416f4d9bd1ca350f1ae14e278e7 (diff)
downloadcatch3-b26486d68ece48a1dfdb208a9f3f1bd8acab0382.tar.gz
Start child processes one at a time; run gcov without a directory
Reading the coverage profiles on several threads broke an assumption of ChildProcess::Start on POSIX: it changes the working directory of the whole process around posix_spawn. Two gcov runs started at once could both run in one test's directory, so on the GCC job the map of "Subtracts one" showed what "Adds one" reached. - ChildProcess::Start holds a lock while a child starts, on POSIX and Windows, so the directory change and the handles a child inherits never overlap with another start. - gcov gets the absolute path of the data file and no working directory, so no directory changes while profiles are read in parallel.
Diffstat (limited to 'src/Progmasoft/Runner/CoverageReport.cpp')
-rw-r--r--src/Progmasoft/Runner/CoverageReport.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Progmasoft/Runner/CoverageReport.cpp b/src/Progmasoft/Runner/CoverageReport.cpp
index fb2760c3..ccdd0538 100644
--- a/src/Progmasoft/Runner/CoverageReport.cpp
+++ b/src/Progmasoft/Runner/CoverageReport.cpp
@@ -239,14 +239,16 @@ namespace Progmasoft::Catch3::Runner
return Error{ "the notes file " + gcno.string()
+ " could not be read: " + error.message() };
}
- auto json = RunTool(
- gcov,
- // Without --branch-probabilities the JSON has no branches.
- { "--json-format",
- "--branch-probabilities",
- "--stdout",
- gcda.filename().string() },
- gcda.parent_path());
+ // The data file by its absolute path, so that gcov needs no
+ // working directory: profiles are read on several threads,
+ // and a working directory is the whole process's.
+ // Without --branch-probabilities the JSON has no branches.
+ auto json
+ = RunTool(gcov,
+ { "--json-format",
+ "--branch-probabilities",
+ "--stdout",
+ std::filesystem::absolute(gcda).string() });
if (!json)
{
return json.GetError();