Test hash rewriting
This commit is contained in:
parent
5e2ffd0b8a
commit
1f7901ec3b
1 changed files with 20 additions and 4 deletions
|
@ -15,7 +15,7 @@ grep -q 'multiple-outputs-a.drv",\["first","second"\]' $drvPath
|
||||||
grep -q 'multiple-outputs-b.drv",\["out"\]' $drvPath
|
grep -q 'multiple-outputs-b.drv",\["out"\]' $drvPath
|
||||||
|
|
||||||
# While we're at it, test the ‘unsafeDiscardOutputDependency’ primop.
|
# While we're at it, test the ‘unsafeDiscardOutputDependency’ primop.
|
||||||
outPath=$(nix-build multiple-outputs.nix -A d)
|
outPath=$(nix-build multiple-outputs.nix -A d --no-out-link)
|
||||||
drvPath=$(cat $outPath/drv)
|
drvPath=$(cat $outPath/drv)
|
||||||
outPath=$(nix-store -q $drvPath)
|
outPath=$(nix-store -q $drvPath)
|
||||||
! [ -e "$outPath" ]
|
! [ -e "$outPath" ]
|
||||||
|
@ -23,17 +23,33 @@ outPath=$(nix-store -q $drvPath)
|
||||||
# Do a build of something that depends on a derivation with multiple
|
# Do a build of something that depends on a derivation with multiple
|
||||||
# outputs.
|
# outputs.
|
||||||
echo "building b..."
|
echo "building b..."
|
||||||
outPath=$(nix-build multiple-outputs.nix -A b)
|
outPath=$(nix-build multiple-outputs.nix -A b --no-out-link)
|
||||||
echo "output path is $outPath"
|
echo "output path is $outPath"
|
||||||
[ "$(cat "$outPath"/file)" = "success" ]
|
[ "$(cat "$outPath"/file)" = "success" ]
|
||||||
|
|
||||||
|
# Test nix-build on a derivation with multiple outputs.
|
||||||
|
nix-build multiple-outputs.nix -A a -o $TEST_ROOT/result
|
||||||
|
[ "$(cat $TEST_ROOT/result-first/file)" = "first" ]
|
||||||
|
[ "$(cat $TEST_ROOT/result-second/file)" = "second" ]
|
||||||
|
[ "$(cat $TEST_ROOT/result-second/link/file)" = "first" ]
|
||||||
|
hash1=$(nix-store -q --hash $TEST_ROOT/result-second)
|
||||||
|
|
||||||
|
# Delete one of the outputs and rebuild it. This will cause a hash
|
||||||
|
# rewrite.
|
||||||
|
nix-store --delete $TEST_ROOT/result-second --ignore-liveness
|
||||||
|
nix-build multiple-outputs.nix -A a -o $TEST_ROOT/result
|
||||||
|
[ "$(cat $TEST_ROOT/result-second/file)" = "second" ]
|
||||||
|
[ "$(cat $TEST_ROOT/result-second/link/file)" = "first" ]
|
||||||
|
hash2=$(nix-store -q --hash $TEST_ROOT/result-second)
|
||||||
|
[ "$hash1" = "$hash2" ]
|
||||||
|
|
||||||
# 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..."
|
echo "building a.first..."
|
||||||
nix-build multiple-outputs.nix -A a.first
|
nix-build multiple-outputs.nix -A a.first --no-out-link
|
||||||
|
|
||||||
# Cyclic outputs should be rejected.
|
# Cyclic outputs should be rejected.
|
||||||
echo "building cyclic..."
|
echo "building cyclic..."
|
||||||
if nix-build multiple-outputs.nix -A cyclic; then
|
if nix-build multiple-outputs.nix -A cyclic --no-out-link; then
|
||||||
echo "Cyclic outputs incorrectly accepted!"
|
echo "Cyclic outputs incorrectly accepted!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue