about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--scripts/nix-build.in9
-rw-r--r--tests/build-hook.sh6
-rw-r--r--tests/export.sh2
-rw-r--r--tests/fixed.sh23
-rw-r--r--tests/logging.sh9
-rw-r--r--tests/nix-build.sh4
-rw-r--r--tests/parallel.sh6
7 files changed, 25 insertions, 34 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index 1deaea58a62c..d90b902aeb09 100644
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -77,7 +77,7 @@ EOF
 
     elsif ($arg eq "--attr" or $arg eq "-A") {
         $n++;
-        die "$0: `--attr' requires an argument\n" unless $n < scalar @ARGV;
+        die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
         push @instArgs, ("--attr", $ARGV[$n]);
     }
 
@@ -87,6 +87,13 @@ EOF
         $n += 2;
     }
 
+    elsif ($arg eq "--log-type") {
+        $n++;
+        die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
+        push @instArgs, ($arg, $ARGV[$n]);
+        push @buildArgs, ($arg, $ARGV[$n]);
+    }
+
     elsif ($arg eq "--option") {
         die "$0: `$arg' requires two arguments\n" unless $n + 2 < scalar @ARGV;
         push @instArgs, ($arg, $ARGV[$n + 1], $ARGV[$n + 2]);
diff --git a/tests/build-hook.sh b/tests/build-hook.sh
index 8cd9e8171fe1..b9de00993654 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 53c9ec3c68df..c7d0a8176720 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 9d5de2929b6f..91c122083035 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 60e2e1234144..dffedcfe59ca 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 22980956be69..aab3615cc51b 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 84326978e74e..577e794bf733 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"