2011-09-14 08:59:29 +03:00
|
|
|
|
source common.sh
|
|
|
|
|
|
2011-12-21 15:47:21 +02:00
|
|
|
|
clearStore
|
2011-09-14 08:59:29 +03:00
|
|
|
|
|
2011-12-21 15:47:21 +02:00
|
|
|
|
# Test whether read-only evaluation works when referring to the
|
|
|
|
|
# ‘drvPath’ attribute.
|
|
|
|
|
echo "evaluating c..."
|
2011-12-21 20:19:05 +02:00
|
|
|
|
#drvPath=$(nix-instantiate multiple-outputs.nix -A c --readonly-mode)
|
2011-12-21 15:47:21 +02:00
|
|
|
|
|
|
|
|
|
# And check whether the resulting derivation explicitly depends on all
|
|
|
|
|
# outputs.
|
2011-12-21 20:19:05 +02:00
|
|
|
|
drvPath=$(nix-instantiate multiple-outputs.nix -A c)
|
|
|
|
|
#[ "$drvPath" = "$drvPath2" ]
|
2011-12-21 15:47:21 +02:00
|
|
|
|
grep -q 'multiple-outputs-a.drv",\["first","second"\]' $drvPath
|
|
|
|
|
grep -q 'multiple-outputs-b.drv",\["out"\]' $drvPath
|
|
|
|
|
|
2011-12-21 16:42:06 +02:00
|
|
|
|
# While we're at it, test the ‘unsafeDiscardOutputDependency’ primop.
|
|
|
|
|
outPath=$(nix-build multiple-outputs.nix -A d)
|
|
|
|
|
drvPath=$(cat $outPath/drv)
|
|
|
|
|
outPath=$(nix-store -q $drvPath)
|
|
|
|
|
! [ -e "$outPath" ]
|
|
|
|
|
|
2011-12-21 15:47:21 +02:00
|
|
|
|
# Do a build of something that depends on a derivation with multiple
|
|
|
|
|
# outputs.
|
|
|
|
|
echo "building b..."
|
2011-12-20 19:01:02 +02:00
|
|
|
|
outPath=$(nix-build multiple-outputs.nix -A b)
|
2011-09-14 08:59:29 +03:00
|
|
|
|
echo "output path is $outPath"
|
2011-12-20 19:01:02 +02:00
|
|
|
|
[ "$(cat "$outPath"/file)" = "success" ]
|
2011-12-20 19:08:43 +02:00
|
|
|
|
|
|
|
|
|
# Make sure that nix-build works on derivations with multiple outputs.
|
2011-12-21 15:47:21 +02:00
|
|
|
|
echo "building a.first..."
|
2011-12-20 19:08:43 +02:00
|
|
|
|
nix-build multiple-outputs.nix -A a.first
|
|
|
|
|
|
|
|
|
|
# Cyclic outputs should be rejected.
|
2011-12-21 15:47:21 +02:00
|
|
|
|
echo "building cyclic..."
|
2011-12-20 19:08:43 +02:00
|
|
|
|
if nix-build multiple-outputs.nix -A cyclic; then
|
|
|
|
|
echo "Cyclic outputs incorrectly accepted!"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2011-12-21 15:47:21 +02:00
|
|
|
|
echo "collecting garbage..."
|
2011-12-20 19:10:39 +02:00
|
|
|
|
nix-store --gc
|