forked from lix-project/lix
Don't put results symlinks in the tests directory
This commit is contained in:
parent
1f7901ec3b
commit
d4c3b6327f
|
@ -2,7 +2,7 @@ source common.sh
|
||||||
|
|
||||||
export NIX_BUILD_HOOK="build-hook.hook.sh"
|
export NIX_BUILD_HOOK="build-hook.hook.sh"
|
||||||
|
|
||||||
outPath=$(nix-build build-hook.nix)
|
outPath=$(nix-build build-hook.nix --no-out-link)
|
||||||
|
|
||||||
echo "output path is $outPath"
|
echo "output path is $outPath"
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,14 @@ clearStore
|
||||||
clearProfiles
|
clearProfiles
|
||||||
|
|
||||||
checkRef() {
|
checkRef() {
|
||||||
nix-store -q --references ./result | grep -q "$1" || fail "missing reference $1"
|
nix-store -q --references $TEST_ROOT/result | grep -q "$1" || fail "missing reference $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test the export of the runtime dependency graph.
|
# Test the export of the runtime dependency graph.
|
||||||
|
|
||||||
outPath=$(nix-build ./export-graph.nix -A runtimeGraph)
|
outPath=$(nix-build ./export-graph.nix -A runtimeGraph -o $TEST_ROOT/result)
|
||||||
|
|
||||||
test $(nix-store -q --references ./result | wc -l) = 2 || fail "bad nr of references"
|
test $(nix-store -q --references $TEST_ROOT/result | wc -l) = 2 || fail "bad nr of references"
|
||||||
|
|
||||||
checkRef input-2
|
checkRef input-2
|
||||||
for i in $(cat $outPath); do checkRef $i; done
|
for i in $(cat $outPath); do checkRef $i; done
|
||||||
|
@ -20,7 +20,7 @@ for i in $(cat $outPath); do checkRef $i; done
|
||||||
|
|
||||||
nix-store --gc # should force rebuild of input-1
|
nix-store --gc # should force rebuild of input-1
|
||||||
|
|
||||||
outPath=$(nix-build ./export-graph.nix -A buildGraph)
|
outPath=$(nix-build ./export-graph.nix -A buildGraph -o $TEST_ROOT/result)
|
||||||
|
|
||||||
checkRef input-1
|
checkRef input-1
|
||||||
checkRef input-1.drv
|
checkRef input-1.drv
|
||||||
|
|
|
@ -2,7 +2,7 @@ source common.sh
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
|
|
||||||
outPath=$(nix-build dependencies.nix)
|
outPath=$(nix-build dependencies.nix --no-out-link)
|
||||||
|
|
||||||
nix-store --export $outPath > $TEST_ROOT/exp
|
nix-store --export $outPath > $TEST_ROOT/exp
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,6 @@ clearStore
|
||||||
|
|
||||||
hash=$(nix-hash --flat --type sha256 ./fetchurl.nix)
|
hash=$(nix-hash --flat --type sha256 ./fetchurl.nix)
|
||||||
|
|
||||||
outPath=$(nix-build ./fetchurl.nix --argstr filename $(pwd)/fetchurl.nix --argstr sha256 $hash)
|
outPath=$(nix-build ./fetchurl.nix --argstr filename $(pwd)/fetchurl.nix --argstr sha256 $hash --no-out-link)
|
||||||
|
|
||||||
cmp $outPath fetchurl.nix
|
cmp $outPath fetchurl.nix
|
||||||
|
|
|
@ -6,13 +6,13 @@ export IMPURE_VAR1=foo
|
||||||
export IMPURE_VAR2=bar
|
export IMPURE_VAR2=bar
|
||||||
|
|
||||||
echo 'testing good...'
|
echo 'testing good...'
|
||||||
nix-build fixed.nix -A good
|
nix-build fixed.nix -A good --no-out-link
|
||||||
|
|
||||||
echo 'testing good2...'
|
echo 'testing good2...'
|
||||||
nix-build fixed.nix -A good2
|
nix-build fixed.nix -A good2 --no-out-link
|
||||||
|
|
||||||
echo 'testing bad...'
|
echo 'testing bad...'
|
||||||
nix-build fixed.nix -A bad && fail "should fail"
|
nix-build fixed.nix -A bad --no-out-link && fail "should fail"
|
||||||
|
|
||||||
echo 'testing reallyBad...'
|
echo 'testing reallyBad...'
|
||||||
nix-instantiate fixed.nix -A reallyBad && fail "should fail"
|
nix-instantiate fixed.nix -A reallyBad && fail "should fail"
|
||||||
|
@ -25,12 +25,12 @@ test $(nix-instantiate fixed.nix -A good.1 | wc -l) = 1
|
||||||
# Only one should run at the same time.
|
# Only one should run at the same time.
|
||||||
echo 'testing parallelSame...'
|
echo 'testing parallelSame...'
|
||||||
clearStore
|
clearStore
|
||||||
nix-build fixed.nix -A parallelSame -j2
|
nix-build fixed.nix -A parallelSame --no-out-link -j2
|
||||||
|
|
||||||
# Fixed-output derivations with a recursive SHA-256 hash should
|
# Fixed-output derivations with a recursive SHA-256 hash should
|
||||||
# produce the same path as "nix-store --add".
|
# produce the same path as "nix-store --add".
|
||||||
echo 'testing sameAsAdd...'
|
echo 'testing sameAsAdd...'
|
||||||
out=$(nix-build fixed.nix -A sameAsAdd)
|
out=$(nix-build fixed.nix -A sameAsAdd --no-out-link)
|
||||||
|
|
||||||
# This is what fixed.builder2 produces...
|
# This is what fixed.builder2 produces...
|
||||||
rm -rf $TEST_ROOT/fixed
|
rm -rf $TEST_ROOT/fixed
|
||||||
|
|
|
@ -7,6 +7,6 @@ if nix-instantiate --readonly-mode ./import-derivation.nix; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
outPath=$(nix-build ./import-derivation.nix)
|
outPath=$(nix-build ./import-derivation.nix --no-out-link)
|
||||||
|
|
||||||
[ "$(cat $outPath)" = FOO579 ]
|
[ "$(cat $outPath)" = FOO579 ]
|
||||||
|
|
|
@ -4,7 +4,7 @@ clearStore
|
||||||
|
|
||||||
# Produce an escaped log file.
|
# Produce an escaped log file.
|
||||||
set -x
|
set -x
|
||||||
nix-build --log-type escapes -vv dependencies.nix 2> $TEST_ROOT/log.esc
|
nix-build --log-type escapes -vv dependencies.nix --no-out-link 2> $TEST_ROOT/log.esc
|
||||||
|
|
||||||
# Convert it to an XML representation.
|
# Convert it to an XML representation.
|
||||||
nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml
|
nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml
|
||||||
|
|
|
@ -9,8 +9,9 @@ rec {
|
||||||
''
|
''
|
||||||
mkdir $first $second
|
mkdir $first $second
|
||||||
test -z $all
|
test -z $all
|
||||||
echo "second" > $first/file
|
echo "first" > $first/file
|
||||||
echo "first" > $second/file
|
echo "second" > $second/file
|
||||||
|
ln -s $first $second/link
|
||||||
'';
|
'';
|
||||||
helloString = "Hello, world!";
|
helloString = "Hello, world!";
|
||||||
};
|
};
|
||||||
|
@ -26,8 +27,8 @@ rec {
|
||||||
mkdir $out
|
mkdir $out
|
||||||
test "$firstOutput $secondOutput" = "$allOutputs"
|
test "$firstOutput $secondOutput" = "$allOutputs"
|
||||||
test "$defaultOutput" = "$firstOutput"
|
test "$defaultOutput" = "$firstOutput"
|
||||||
test "$(cat $firstOutput/file)" = "second"
|
test "$(cat $firstOutput/file)" = "first"
|
||||||
test "$(cat $secondOutput/file)" = "first"
|
test "$(cat $secondOutput/file)" = "second"
|
||||||
echo "success" > $out/file
|
echo "success" > $out/file
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,16 +7,16 @@ set +e
|
||||||
opts="--option build-cache-failure true --print-build-trace"
|
opts="--option build-cache-failure true --print-build-trace"
|
||||||
|
|
||||||
# This build should fail, and the failure should be cached.
|
# This build should fail, and the failure should be cached.
|
||||||
log=$(nix-build $opts negative-caching.nix -A fail 2>&1) && fail "should fail"
|
log=$(nix-build $opts negative-caching.nix -A fail --no-out-link 2>&1) && fail "should fail"
|
||||||
echo "$log" | grep -q "@ build-failed" || fail "no build-failed trace"
|
echo "$log" | grep -q "@ build-failed" || fail "no build-failed trace"
|
||||||
|
|
||||||
# Do it again. The build shouldn't be tried again.
|
# Do it again. The build shouldn't be tried again.
|
||||||
log=$(nix-build $opts negative-caching.nix -A fail 2>&1) && fail "should fail"
|
log=$(nix-build $opts negative-caching.nix -A fail --no-out-link 2>&1) && fail "should fail"
|
||||||
echo "$log" | grep -q "FAIL" && fail "failed build not cached"
|
echo "$log" | grep -q "FAIL" && fail "failed build not cached"
|
||||||
echo "$log" | grep -q "@ build-failed .* cached" || fail "trace doesn't say cached"
|
echo "$log" | grep -q "@ build-failed .* cached" || fail "trace doesn't say cached"
|
||||||
|
|
||||||
# Check that --keep-going works properly with cached failures.
|
# Check that --keep-going works properly with cached failures.
|
||||||
log=$(nix-build $opts --keep-going negative-caching.nix -A depOnFail 2>&1) && fail "should fail"
|
log=$(nix-build $opts --keep-going negative-caching.nix -A depOnFail --no-out-link 2>&1) && fail "should fail"
|
||||||
echo "$log" | grep -q "FAIL" && fail "failed build not cached (2)"
|
echo "$log" | grep -q "FAIL" && fail "failed build not cached (2)"
|
||||||
echo "$log" | grep -q "@ build-failed .* cached" || fail "trace doesn't say cached (2)"
|
echo "$log" | grep -q "@ build-failed .* cached" || fail "trace doesn't say cached (2)"
|
||||||
echo "$log" | grep -q "@ build-succeeded .*-succeed" || fail "didn't keep going"
|
echo "$log" | grep -q "@ build-succeeded .*-succeed" || fail "didn't keep going"
|
||||||
|
|
|
@ -2,7 +2,7 @@ source common.sh
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
|
|
||||||
(cd $TEST_ROOT && nix-build ../dependencies.nix)
|
nix-build dependencies.nix -o $TEST_ROOT/result
|
||||||
test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
|
test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
|
||||||
|
|
||||||
# The result should be retained by a GC.
|
# The result should be retained by a GC.
|
||||||
|
|
|
@ -8,7 +8,7 @@ clearStore
|
||||||
|
|
||||||
rm -f $SHARED.cur $SHARED.max
|
rm -f $SHARED.cur $SHARED.max
|
||||||
|
|
||||||
outPath=$(nix-build -j10000 parallel.nix)
|
outPath=$(nix-build -j10000 parallel.nix --no-out-link)
|
||||||
|
|
||||||
echo "output path is $outPath"
|
echo "output path is $outPath"
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ if badDrv2=$(nix-store --add $TEST_ROOT/bad.drv); then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Now build the good derivation.
|
# Now build the good derivation.
|
||||||
goodOut2=$(nix-build ./secure-drv-outputs.nix -A good)
|
goodOut2=$(nix-build ./secure-drv-outputs.nix -A good --no-out-link)
|
||||||
test "$goodOut" = "$goodOut2"
|
test "$goodOut" = "$goodOut2"
|
||||||
|
|
||||||
if ! test -e "$goodOut"/good; then
|
if ! test -e "$goodOut"/good; then
|
||||||
|
|
Loading…
Reference in a new issue