aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-09-28 23:18:35 +0200
committereldritch horrors <pennae@lix.systems>2024-09-29 13:17:15 +0000
commit1a52e4f755c3fcc50e58f7a0b04269a3839b7eea (patch)
treea2fddb201b17464a56cedabda8ea2651143879e8 /src/libstore
parent3f7519526f7e2cd3ede01c3910fbfe2ddf0f051f (diff)
libstore: fix build tests
the new event loop could very occasionally notice that a dependency of some goal has failed, process the failure, cause the depending goal to fail accordingly, and in the doing of the latter two steps let further dependencies that previously have not been reported as failed do their reporting anyway. in such cases a goal could fail with "1 dependencies failed", but more than one dependency failure message was shown. we'll now report the correct number of failed dependency goals in all cases. Change-Id: I5aa95dcb2db4de4fd5fee8acbf5db833531d81a8
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build/goal.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/libstore/build/goal.cc b/src/libstore/build/goal.cc
index 8a2f4ab35..5f0ed485c 100644
--- a/src/libstore/build/goal.cc
+++ b/src/libstore/build/goal.cc
@@ -33,18 +33,22 @@ kj::Promise<Result<Goal::WorkResult>>
Goal::waitForGoals(kj::Array<std::pair<GoalPtr, kj::Promise<void>>> dependencies) noexcept
try {
auto left = dependencies.size();
+ for (auto & [dep, p] : dependencies) {
+ p = p.then([this, dep, &left] {
+ left--;
+ trace(fmt("waitee '%s' done; %d left", dep->name, left));
+
+ if (dep->exitCode != Goal::ecSuccess) ++nrFailed;
+ if (dep->exitCode == Goal::ecNoSubstituters) ++nrNoSubstituters;
+ if (dep->exitCode == Goal::ecIncompleteClosure) ++nrIncompleteClosure;
+ }).eagerlyEvaluate(nullptr);
+ }
+
auto collectDeps = asyncCollect(std::move(dependencies));
while (auto item = co_await collectDeps.next()) {
- left--;
auto & dep = *item;
- trace(fmt("waitee '%s' done; %d left", dep->name, left));
-
- if (dep->exitCode != Goal::ecSuccess) ++nrFailed;
- if (dep->exitCode == Goal::ecNoSubstituters) ++nrNoSubstituters;
- if (dep->exitCode == Goal::ecIncompleteClosure) ++nrIncompleteClosure;
-
waiteeDone(dep);
if (dep->exitCode == ecFailed && !settings.keepGoing) {