Test RemoteStore::buildDerivation

Fix `wopNarFromPath` which needed a `toRealPath`.
This commit is contained in:
John Ericson 2020-08-12 13:24:39 +00:00
parent 5d67f18c86
commit d2f2be0f70
3 changed files with 30 additions and 7 deletions

View file

@ -688,7 +688,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
auto path = store->parseStorePath(readString(from));
logger->startWork();
logger->stopWork();
dumpPath(store->printStorePath(path), to);
dumpPath(store->toRealPath(store->printStorePath(path)), to);
break;
}

View file

@ -26,6 +26,16 @@ let
requiredSystemFeatures = ["bar"];
};
input3 = mkDerivation {
shell = busybox;
name = "build-remote-input-3";
buildCommand = ''
read x < ${input2}
echo $x BAZ > $out
'';
requiredSystemFeatures = ["baz"];
};
in
mkDerivation {
@ -34,7 +44,7 @@ in
buildCommand =
''
read x < ${input1}
read y < ${input2}
read y < ${input3}
echo "$x $y" > $out
'';
}

View file

@ -13,6 +13,7 @@ builders=(
# remote-store URL.
"ssh://localhost?remote-store=$TEST_ROOT/machine1?system-features=foo - - 1 1 foo"
"$TEST_ROOT/machine2 - - 1 1 bar"
"ssh-ng://localhost?remote-store=$TEST_ROOT/machine3?system-features=baz - - 1 1 baz"
)
# Note: ssh://localhost bypasses ssh, directly invoking nix-store as a
@ -25,12 +26,24 @@ nix build -L -v -f build-hook.nix -o $TEST_ROOT/result --max-jobs 0 \
outPath=$(readlink -f $TEST_ROOT/result)
grep 'FOO BAR' $TEST_ROOT/machine0/$outPath
grep 'FOO BAR BAZ' $TEST_ROOT/machine0/$outPath
set -o pipefail
# Ensure that input1 was built on store1 due to the required feature.
(! nix path-info --store $TEST_ROOT/machine2 --all | grep builder-build-remote-input-1.sh)
nix path-info --store $TEST_ROOT/machine1 --all | grep builder-build-remote-input-1.sh
nix path-info --store $TEST_ROOT/machine1 --all \
| grep builder-build-remote-input-1.sh \
| grep -v builder-build-remote-input-2.sh \
| grep -v builder-build-remote-input-3.sh
# Ensure that input2 was built on store2 due to the required feature.
(! nix path-info --store $TEST_ROOT/machine1 --all | grep builder-build-remote-input-2.sh)
nix path-info --store $TEST_ROOT/machine2 --all | grep builder-build-remote-input-2.sh
nix path-info --store $TEST_ROOT/machine2 --all \
| grep -v builder-build-remote-input-1.sh \
| grep builder-build-remote-input-2.sh \
| grep -v builder-build-remote-input-3.sh
# Ensure that input3 was built on store3 due to the required feature.
nix path-info --store $TEST_ROOT/machine3 --all \
| grep -v builder-build-remote-input-1.sh \
| grep -v builder-build-remote-input-2.sh \
| grep builder-build-remote-input-3.sh