Skip to content

Commit

Permalink
Don't put results symlinks in the tests directory
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Sep 11, 2012
1 parent 1f7901e commit d4c3b63
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion tests/build-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
8 changes: 4 additions & 4 deletions tests/export-graph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/fetchurl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions tests/fixed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/import-derivation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
2 changes: 1 addition & 1 deletion tests/logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions tests/multiple-outputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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!";
};
Expand All @@ -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
'';
};
Expand Down
6 changes: 3 additions & 3 deletions tests/negative-caching.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion tests/nix-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion tests/secure-drv-outputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d4c3b63

Please sign in to comment.