diff --git a/src/libstore/build/derivation-building-goal.cc b/src/libstore/build/derivation-building-goal.cc index 19296fac3..9a91b3592 100644 --- a/src/libstore/build/derivation-building-goal.cc +++ b/src/libstore/build/derivation-building-goal.cc @@ -613,9 +613,6 @@ Goal::Co DerivationBuildingGoal::tryToBuild() void closeLogFile() override { goal.closeLogFile(); } - SingleDrvOutputs assertPathValidity() override { - return goal.assertPathValidity(); - } void appendLogTailErrorMsg(std::string & msg) override { goal.appendLogTailErrorMsg(msg); } diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index b1f081115..3fcc376ed 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -210,6 +210,13 @@ Goal::Co DerivationGoal::haveDerivation(StorePath drvPath) .outputs = wantedOutputs, }); + if (buildMode == bmCheck) { + /* In checking mode, the builder will not register any outputs. + So we want to make sure the ones that we wanted to check are + properly there. */ + buildResult.builtOutputs = assertPathValidity(drvPath); + } + co_return amDone(g->exitCode, g->ex); }; diff --git a/src/libstore/unix/build/derivation-builder.cc b/src/libstore/unix/build/derivation-builder.cc index eca017487..1f15cc9e9 100644 --- a/src/libstore/unix/build/derivation-builder.cc +++ b/src/libstore/unix/build/derivation-builder.cc @@ -589,10 +589,10 @@ static void replaceValidPath(const Path & storePath, const Path & tmpPath) way first. We'd better not be interrupted here, because if we're repairing (say) Glibc, we end up with a broken system. */ Path oldPath; - + if (pathExists(storePath)) { // why do we loop here? - // although makeTempPath should be unique, we can't + // although makeTempPath should be unique, we can't // guarantee that. do { oldPath = makeTempPath(storePath, ".old"); @@ -1871,7 +1871,7 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs() also a source for non-determinism. */ if (delayedException) std::rethrow_exception(delayedException); - return miscMethods->assertPathValidity(); + return {}; } /* Apply output checks. */ diff --git a/src/libstore/unix/include/nix/store/build/derivation-builder.hh b/src/libstore/unix/include/nix/store/build/derivation-builder.hh index 01266a492..5ce38e034 100644 --- a/src/libstore/unix/include/nix/store/build/derivation-builder.hh +++ b/src/libstore/unix/include/nix/store/build/derivation-builder.hh @@ -97,14 +97,6 @@ struct DerivationBuilderCallbacks */ virtual void closeLogFile() = 0; - /** - * Aborts if any output is not valid or corrupt, and otherwise - * returns a 'SingleDrvOutputs' structure containing all outputs. - * - * @todo Probably should just be in `DerivationGoal`. - */ - virtual SingleDrvOutputs assertPathValidity() = 0; - virtual void appendLogTailErrorMsg(std::string & msg) = 0; /** diff --git a/tests/functional/check.sh b/tests/functional/check.sh index b21349288..a1c6decf5 100755 --- a/tests/functional/check.sh +++ b/tests/functional/check.sh @@ -22,6 +22,11 @@ clearStore nix-build dependencies.nix --no-out-link nix-build dependencies.nix --no-out-link --check +# Make sure checking just one output works (#13293) +nix-build multiple-outputs.nix -A a --no-out-link +nix-store --delete "$(nix-build multiple-outputs.nix -A a.second --no-out-link)" +nix-build multiple-outputs.nix -A a.first --no-out-link --check + # Build failure exit codes (100, 104, etc.) are from # doc/manual/source/command-ref/status-build-failure.md