diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-03-18 13:15:55 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-03-18 13:15:55 +0000 |
commit | 1dcf208f562d853909ad53772c208dcb2a73de88 (patch) | |
tree | b7f79afeb5bc7531c63dead1567913bed523a781 /tests | |
parent | 93b6926054b0b339d310a3075a677a65676c7c11 (diff) |
* Clean up some tests (use nix-build where appropriate).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/build-hook.sh | 6 | ||||
-rw-r--r-- | tests/export.sh | 2 | ||||
-rw-r--r-- | tests/fixed.sh | 23 | ||||
-rw-r--r-- | tests/logging.sh | 9 | ||||
-rw-r--r-- | tests/nix-build.sh | 4 | ||||
-rw-r--r-- | tests/parallel.sh | 6 |
6 files changed, 17 insertions, 33 deletions
diff --git a/tests/build-hook.sh b/tests/build-hook.sh index 8cd9e8171..b9de00993 100644 --- a/tests/build-hook.sh +++ b/tests/build-hook.sh @@ -2,11 +2,7 @@ source common.sh export NIX_BUILD_HOOK="build-hook.hook.sh" -drvPath=$($nixinstantiate build-hook.nix) - -echo "derivation is $drvPath" - -outPath=$($nixstore -quf "$drvPath") +outPath=$($nixbuild build-hook.nix) echo "output path is $outPath" diff --git a/tests/export.sh b/tests/export.sh index 53c9ec3c6..c7d0a8176 100644 --- a/tests/export.sh +++ b/tests/export.sh @@ -2,7 +2,7 @@ source common.sh clearStore -outPath=$($nixstore -r $($nixinstantiate dependencies.nix)) +outPath=$($nixbuild dependencies.nix) $nixstore --export $outPath > $TEST_ROOT/exp diff --git a/tests/fixed.sh b/tests/fixed.sh index 9d5de2929..91c122083 100644 --- a/tests/fixed.sh +++ b/tests/fixed.sh @@ -6,22 +6,16 @@ export IMPURE_VAR1=foo export IMPURE_VAR2=bar echo 'testing good...' -drvs=$($nixinstantiate fixed.nix -A good) -echo $drvs -$nixstore -r $drvs +$nixbuild fixed.nix -A good echo 'testing good2...' -drvs=$($nixinstantiate fixed.nix -A good2) -echo $drvs -$nixstore -r $drvs +$nixbuild fixed.nix -A good2 echo 'testing bad...' -drvs=$($nixinstantiate fixed.nix -A bad) -echo $drvs -if $nixstore -r $drvs; then false; fi +$nixbuild fixed.nix -A bad && fail "should fail" echo 'testing reallyBad...' -if $nixinstantiate fixed.nix -A reallyBad; then false; fi +$nixinstantiate fixed.nix -A reallyBad && fail "should fail" # While we're at it, check attribute selection a bit more. echo 'testing attribute selection...' @@ -31,17 +25,12 @@ test $($nixinstantiate fixed.nix -A good.1 | wc -l) = 1 # Only one should run at the same time. echo 'testing parallelSame...' clearStore -drvs=$($nixinstantiate fixed.nix -A parallelSame) -echo $drvs -$nixstore -r $drvs -j2 +$nixbuild fixed.nix -A parallelSame -j2 # Fixed-output derivations with a recursive SHA-256 hash should # produce the same path as "nix-store --add". echo 'testing sameAsAdd...' -drv=$($nixinstantiate fixed.nix -A sameAsAdd) -echo $drv -out=$($nixstore -r $drv) -echo $out +out=$($nixbuild fixed.nix -A sameAsAdd) # This is what fixed.builder2 produces... rm -rf $TEST_ROOT/fixed diff --git a/tests/logging.sh b/tests/logging.sh index 60e2e1234..dffedcfe5 100644 --- a/tests/logging.sh +++ b/tests/logging.sh @@ -1,16 +1,17 @@ source common.sh -$nixstore --gc +clearStore # Produce an escaped log file. -$nixstore --log-type escapes -r -vv $($nixinstantiate dependencies.nix) 2> $TEST_ROOT/log.esc +set -x +$nixbuild --log-type escapes -vv dependencies.nix 2> $TEST_ROOT/log.esc # Convert it to an XML representation. $TOP/src/nix-log2xml/nix-log2xml < $TEST_ROOT/log.esc > $TEST_ROOT/log.xml # Is this well-formed XML? if test "$xmllint" != "false"; then - $xmllint $xmlflags --noout $TEST_ROOT/log.xml + $xmllint $xmlflags --noout $TEST_ROOT/log.xml || fail "malformed XML" fi # Convert to HTML. @@ -19,5 +20,5 @@ if test "$xsltproc" != "false"; then # Ideally we would check that the generated HTML is valid... # A few checks... - grep "<li>.*<code>.*FOO" $TEST_ROOT/log.html + grep "<code>.*FOO" $TEST_ROOT/log.html || fail "bad HTML output" fi diff --git a/tests/nix-build.sh b/tests/nix-build.sh index 22980956b..aab3615cc 100644 --- a/tests/nix-build.sh +++ b/tests/nix-build.sh @@ -1,8 +1,8 @@ source common.sh -$nixstore --gc +clearStore -(cd $TEST_ROOT && $NIX_BIN_DIR/nix-build ../dependencies.nix) +(cd $TEST_ROOT && $nixbuild ../dependencies.nix) 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 84326978e..577e794bf 100644 --- a/tests/parallel.sh +++ b/tests/parallel.sh @@ -1,10 +1,8 @@ source common.sh -drvPath=$($nixinstantiate parallel.nix) +clearStore -echo "derivation is $drvPath" - -outPath=$($nixstore -qfvv -j10000 "$drvPath") +outPath=$($nixbuild -vv -j10000 parallel.nix) echo "output path is $outPath" |