tvl-depot/tests/multiple-outputs.sh
Eelco Dolstra 4be5a2c096 * Add a test for unsafeDiscardOutputDependency. Not really related to
multiple outputs, but good to have anyway.
2011-12-21 14:42:06 +00:00

42 lines
1.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

source common.sh
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
# 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" ]
# Do a build of something that depends on a derivation with multiple
# outputs.
echo "building b..."
outPath=$(nix-build multiple-outputs.nix -A b)
echo "output path is $outPath"
[ "$(cat "$outPath"/file)" = "success" ]
# Make sure that nix-build works on derivations with multiple outputs.
echo "building a.first..."
nix-build multiple-outputs.nix -A a.first
# Cyclic outputs should be rejected.
echo "building cyclic..."
if nix-build multiple-outputs.nix -A cyclic; then
echo "Cyclic outputs incorrectly accepted!"
exit 1
fi
echo "collecting garbage..."
nix-store --gc