* Add a test for referring to another derivation's ‘drvPath’. This
currently fails in read-only mode.
This commit is contained in:
parent
edd9359beb
commit
179409b911
2 changed files with 29 additions and 1 deletions
|
@ -32,6 +32,16 @@ rec {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
c = mkDerivation {
|
||||||
|
name = "multiple-outputs-c";
|
||||||
|
drv = b.drvPath;
|
||||||
|
builder = builtins.toFile "builder.sh"
|
||||||
|
''
|
||||||
|
mkdir $out
|
||||||
|
ln -s $drv $out/drv
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
cyclic = (mkDerivation {
|
cyclic = (mkDerivation {
|
||||||
name = "cyclic-outputs";
|
name = "cyclic-outputs";
|
||||||
outputs = [ "a" "b" ];
|
outputs = [ "a" "b" ];
|
||||||
|
|
|
@ -1,18 +1,36 @@
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
echo "Testing multiple outputs..."
|
clearStore
|
||||||
|
|
||||||
|
# Test whether read-only evaluation works when referring to the
|
||||||
|
# ‘drvPath’ attribute.
|
||||||
|
echo "evaluating c..."
|
||||||
|
drvPath=$(nix-instantiate multiple-outputs.nix -A c --readonly-mode)
|
||||||
|
|
||||||
|
# And check whether the resulting derivation explicitly depends on all
|
||||||
|
# outputs.
|
||||||
|
drvPath2=$(nix-instantiate multiple-outputs.nix -A c)
|
||||||
|
[ "$drvPath" = "$drvPath2" ]
|
||||||
|
grep -q 'multiple-outputs-a.drv",\["first","second"\]' $drvPath
|
||||||
|
grep -q 'multiple-outputs-b.drv",\["out"\]' $drvPath
|
||||||
|
|
||||||
|
# Do a build of something that depends on a derivation with multiple
|
||||||
|
# outputs.
|
||||||
|
echo "building b..."
|
||||||
outPath=$(nix-build multiple-outputs.nix -A b)
|
outPath=$(nix-build multiple-outputs.nix -A b)
|
||||||
echo "output path is $outPath"
|
echo "output path is $outPath"
|
||||||
[ "$(cat "$outPath"/file)" = "success" ]
|
[ "$(cat "$outPath"/file)" = "success" ]
|
||||||
|
|
||||||
# Make sure that nix-build works on derivations with multiple outputs.
|
# Make sure that nix-build works on derivations with multiple outputs.
|
||||||
|
echo "building a.first..."
|
||||||
nix-build multiple-outputs.nix -A a.first
|
nix-build multiple-outputs.nix -A a.first
|
||||||
|
|
||||||
# Cyclic outputs should be rejected.
|
# Cyclic outputs should be rejected.
|
||||||
|
echo "building cyclic..."
|
||||||
if nix-build multiple-outputs.nix -A cyclic; then
|
if nix-build multiple-outputs.nix -A cyclic; then
|
||||||
echo "Cyclic outputs incorrectly accepted!"
|
echo "Cyclic outputs incorrectly accepted!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "collecting garbage..."
|
||||||
nix-store --gc
|
nix-store --gc
|
||||||
|
|
Loading…
Reference in a new issue