forked from lix-project/lix
Fix tests on systems with a non-master git defaultBranch #1
|
@ -26,7 +26,6 @@ try {
|
||||||
|
|
||||||
trace("done");
|
trace("done");
|
||||||
|
|
||||||
notify->fulfill(result);
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
co_return std::move(result);
|
co_return std::move(result);
|
||||||
|
|
|
@ -48,6 +48,10 @@ Worker::~Worker()
|
||||||
their destructors). */
|
their destructors). */
|
||||||
children.clear();
|
children.clear();
|
||||||
|
|
||||||
|
derivationGoals.clear();
|
||||||
|
drvOutputSubstitutionGoals.clear();
|
||||||
|
substitutionGoals.clear();
|
||||||
|
|
||||||
assert(expectedSubstitutions == 0);
|
assert(expectedSubstitutions == 0);
|
||||||
assert(expectedDownloadSize == 0);
|
assert(expectedDownloadSize == 0);
|
||||||
assert(expectedNarSize == 0);
|
assert(expectedNarSize == 0);
|
||||||
|
@ -71,21 +75,21 @@ std::pair<std::shared_ptr<G>, kj::Promise<Result<Goal::WorkResult>>> Worker::mak
|
||||||
auto goal = goal_weak.goal.lock();
|
auto goal = goal_weak.goal.lock();
|
||||||
if (!goal) {
|
if (!goal) {
|
||||||
goal = create();
|
goal = create();
|
||||||
goal->notify = std::move(goal_weak.fulfiller);
|
|
||||||
goal_weak.goal = goal;
|
goal_weak.goal = goal;
|
||||||
// do not start working immediately. if we are not yet running we
|
// do not start working immediately. if we are not yet running we
|
||||||
// may create dependencies as though they were toplevel goals, in
|
// may create dependencies as though they were toplevel goals, in
|
||||||
// which case the dependencies will not report build errors. when
|
// which case the dependencies will not report build errors. when
|
||||||
// we are running we may be called for this same goal more times,
|
// we are running we may be called for this same goal more times,
|
||||||
// and then we want to modify rather than recreate when possible.
|
// and then we want to modify rather than recreate when possible.
|
||||||
childStarted(goal, kj::evalLater([goal] { return goal->work(); }));
|
goal_weak.promise = kj::evalLater([goal] { return goal->work(); }).fork();
|
||||||
|
childStarted(goal, goal_weak.promise.addBranch());
|
||||||
} else {
|
} else {
|
||||||
if (!modify(*goal)) {
|
if (!modify(*goal)) {
|
||||||
goal_weak = {};
|
goal_weak = {};
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {goal, goal_weak.promise->addBranch()};
|
return {goal, goal_weak.promise.addBranch()};
|
||||||
}
|
}
|
||||||
assert(false && "could not make a goal. possible concurrent worker access");
|
assert(false && "could not make a goal. possible concurrent worker access");
|
||||||
}
|
}
|
||||||
|
@ -224,8 +228,6 @@ void Worker::childStarted(GoalPtr goal, kj::Promise<Result<Goal::WorkResult>> pr
|
||||||
.then([this, goal](auto result) {
|
.then([this, goal](auto result) {
|
||||||
if (result.has_value()) {
|
if (result.has_value()) {
|
||||||
goalFinished(goal, result.assume_value());
|
goalFinished(goal, result.assume_value());
|
||||||
} else {
|
|
||||||
goal->notify->fulfill(result.assume_error());
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,15 +96,7 @@ private:
|
||||||
struct CachedGoal
|
struct CachedGoal
|
||||||
{
|
{
|
||||||
std::weak_ptr<G> goal;
|
std::weak_ptr<G> goal;
|
||||||
kj::Own<kj::ForkedPromise<Result<Goal::WorkResult>>> promise;
|
kj::ForkedPromise<Result<Goal::WorkResult>> promise{nullptr};
|
||||||
kj::Own<kj::PromiseFulfiller<Result<Goal::WorkResult>>> fulfiller;
|
|
||||||
|
|
||||||
CachedGoal()
|
|
||||||
{
|
|
||||||
auto pf = kj::newPromiseAndFulfiller<Result<Goal::WorkResult>>();
|
|
||||||
promise = kj::heap(pf.promise.fork());
|
|
||||||
fulfiller = std::move(pf.fulfiller);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Maps used to prevent multiple instantiations of a goal for the
|
* Maps used to prevent multiple instantiations of a goal for the
|
||||||
|
|
Loading…
Reference in a new issue