From d4c3b6327ff88273462cec57b0e2805d333c386e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 11 Sep 2012 19:14:15 -0400 Subject: [PATCH] Don't put results symlinks in the tests directory --- tests/build-hook.sh | 2 +- tests/export-graph.sh | 8 ++++---- tests/export.sh | 2 +- tests/fetchurl.sh | 2 +- tests/fixed.sh | 10 +++++----- tests/import-derivation.sh | 2 +- tests/logging.sh | 2 +- tests/multiple-outputs.nix | 9 +++++---- tests/negative-caching.sh | 6 +++--- tests/nix-build.sh | 2 +- tests/parallel.sh | 2 +- tests/secure-drv-outputs.sh | 2 +- 12 files changed, 25 insertions(+), 24 deletions(-) diff --git a/tests/build-hook.sh b/tests/build-hook.sh index c733b268..681f65cc 100644 --- a/tests/build-hook.sh +++ b/tests/build-hook.sh @@ -2,7 +2,7 @@ source common.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" diff --git a/tests/export-graph.sh b/tests/export-graph.sh index 7adbefd1..7f6f83d8 100644 --- a/tests/export-graph.sh +++ b/tests/export-graph.sh @@ -4,14 +4,14 @@ clearStore clearProfiles 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. -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 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 -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.drv diff --git a/tests/export.sh b/tests/export.sh index 13681974..ec7560f1 100644 --- a/tests/export.sh +++ b/tests/export.sh @@ -2,7 +2,7 @@ source common.sh clearStore -outPath=$(nix-build dependencies.nix) +outPath=$(nix-build dependencies.nix --no-out-link) nix-store --export $outPath > $TEST_ROOT/exp diff --git a/tests/fetchurl.sh b/tests/fetchurl.sh index bb6180ca..6acc87ea 100644 --- a/tests/fetchurl.sh +++ b/tests/fetchurl.sh @@ -4,6 +4,6 @@ clearStore 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 diff --git a/tests/fixed.sh b/tests/fixed.sh index 16479156..ed0d06dd 100644 --- a/tests/fixed.sh +++ b/tests/fixed.sh @@ -6,13 +6,13 @@ export IMPURE_VAR1=foo export IMPURE_VAR2=bar echo 'testing good...' -nix-build fixed.nix -A good +nix-build fixed.nix -A good --no-out-link echo 'testing good2...' -nix-build fixed.nix -A good2 +nix-build fixed.nix -A good2 --no-out-link 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...' 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. echo 'testing parallelSame...' 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 # produce the same path as "nix-store --add". 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... rm -rf $TEST_ROOT/fixed diff --git a/tests/import-derivation.sh b/tests/import-derivation.sh index 93a53a83..98d61ef4 100644 --- a/tests/import-derivation.sh +++ b/tests/import-derivation.sh @@ -7,6 +7,6 @@ if nix-instantiate --readonly-mode ./import-derivation.nix; then exit 1 fi -outPath=$(nix-build ./import-derivation.nix) +outPath=$(nix-build ./import-derivation.nix --no-out-link) [ "$(cat $outPath)" = FOO579 ] diff --git a/tests/logging.sh b/tests/logging.sh index 2879354c..117d4837 100644 --- a/tests/logging.sh +++ b/tests/logging.sh @@ -4,7 +4,7 @@ clearStore # Produce an escaped log file. 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. nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml diff --git a/tests/multiple-outputs.nix b/tests/multiple-outputs.nix index 6add7dd6..4a9010d1 100644 --- a/tests/multiple-outputs.nix +++ b/tests/multiple-outputs.nix @@ -9,8 +9,9 @@ rec { '' mkdir $first $second test -z $all - echo "second" > $first/file - echo "first" > $second/file + echo "first" > $first/file + echo "second" > $second/file + ln -s $first $second/link ''; helloString = "Hello, world!"; }; @@ -26,8 +27,8 @@ rec { mkdir $out test "$firstOutput $secondOutput" = "$allOutputs" test "$defaultOutput" = "$firstOutput" - test "$(cat $firstOutput/file)" = "second" - test "$(cat $secondOutput/file)" = "first" + test "$(cat $firstOutput/file)" = "first" + test "$(cat $secondOutput/file)" = "second" echo "success" > $out/file ''; }; diff --git a/tests/negative-caching.sh b/tests/negative-caching.sh index 7cbab00e..4217bc38 100644 --- a/tests/negative-caching.sh +++ b/tests/negative-caching.sh @@ -7,16 +7,16 @@ set +e opts="--option build-cache-failure true --print-build-trace" # 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" # 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 "@ build-failed .* cached" || fail "trace doesn't say cached" # 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 "@ build-failed .* cached" || fail "trace doesn't say cached (2)" echo "$log" | grep -q "@ build-succeeded .*-succeed" || fail "didn't keep going" diff --git a/tests/nix-build.sh b/tests/nix-build.sh index d575e9aa..dc0e99c7 100644 --- a/tests/nix-build.sh +++ b/tests/nix-build.sh @@ -2,7 +2,7 @@ source common.sh clearStore -(cd $TEST_ROOT && nix-build ../dependencies.nix) +nix-build dependencies.nix -o $TEST_ROOT/result test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR # The result should be retained by a GC. diff --git a/tests/parallel.sh b/tests/parallel.sh index 13349e87..9b150263 100644 --- a/tests/parallel.sh +++ b/tests/parallel.sh @@ -8,7 +8,7 @@ clearStore 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" diff --git a/tests/secure-drv-outputs.sh b/tests/secure-drv-outputs.sh index 3cb88999..4888123d 100644 --- a/tests/secure-drv-outputs.sh +++ b/tests/secure-drv-outputs.sh @@ -28,7 +28,7 @@ if badDrv2=$(nix-store --add $TEST_ROOT/bad.drv); then fi # 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" if ! test -e "$goodOut"/good; then