about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/init.sh2
-rw-r--r--tests/logging.sh1
-rw-r--r--tests/nix-build.sh17
-rw-r--r--tests/nix-pull.sh4
5 files changed, 24 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 540665ea9ef0..225f780b8ec5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,7 @@ TESTS_ENVIRONMENT = $(SHELL) -e
 extra1 = $(shell pwd)/test-tmp/shared
 
 simple.sh: simple.nix
-dependencies.sh gc.sh nix-push.sh nix-pull.in logging.sh: dependencies.nix
+dependencies.sh gc.sh nix-push.sh nix-pull.in logging.sh nix-build.sh: dependencies.nix
 locking.sh: locking.nix
 parallel.sh: parallel.nix
 build-hook.sh: build-hook.nix
@@ -16,7 +16,7 @@ user-envs.sh: user-envs.nix
 TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \
   build-hook.sh substitutes.sh substitutes2.sh fallback.sh nix-push.sh gc.sh \
   gc-concurrent.sh verify.sh nix-pull.sh referrers.sh user-envs.sh \
-  logging.sh misc.sh
+  logging.sh nix-build.sh misc.sh
 
 XFAIL_TESTS =
 
diff --git a/tests/init.sh b/tests/init.sh
index a11d63f75924..11e0632a4842 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -23,6 +23,7 @@ ln -s $nixinstantiate $NIX_BIN_DIR/
 ln -s $nixhash $NIX_BIN_DIR/
 ln -s $TOP/scripts/nix-prefetch-url $NIX_BIN_DIR/
 ln -s $TOP/scripts/nix-collect-garbage $NIX_BIN_DIR/
+ln -s $TOP/scripts/nix-build $NIX_BIN_DIR/
 mkdir $NIX_BIN_DIR/nix
 ln -s $TOP/scripts/download-using-manifests.pl $NIX_BIN_DIR/nix/
 ln -s $TOP/scripts/readmanifest.pm $NIX_BIN_DIR/nix/
@@ -48,6 +49,7 @@ for i in \
     $NIX_BIN_DIR/nix/download-using-manifests.pl \
     $NIX_BIN_DIR/nix-prefetch-url \
     $NIX_BIN_DIR/nix-collect-garbage \
+    $NIX_BIN_DIR/nix-build \
     ; do
     echo "$REAL_BIN_DIR"
     sed < $i > $i.tmp \
diff --git a/tests/logging.sh b/tests/logging.sh
index 50808d264b91..80d186a754bc 100644
--- a/tests/logging.sh
+++ b/tests/logging.sh
@@ -1,7 +1,6 @@
 source common.sh
 
 $nixstore --gc
-$nixstore --clear-substitutes
 
 # Produce an escaped log file.
 $nixstore --log-type escapes -r -vv $($nixinstantiate dependencies.nix) 2> $TEST_ROOT/log.esc
diff --git a/tests/nix-build.sh b/tests/nix-build.sh
new file mode 100644
index 000000000000..23f8ce99875f
--- /dev/null
+++ b/tests/nix-build.sh
@@ -0,0 +1,17 @@
+source common.sh
+
+$nixstore --gc
+
+(cd $TEST_ROOT && $NIX_BIN_DIR/nix-build ../dependencies.nix)
+test "$(cat $TEST_ROOT/result/foobar)" = FOOBAR
+
+# The result should be retained by a GC.
+target=$(ls -l $TEST_ROOT/result | sed 's/.*->\ //')
+echo target is $target
+$nixstore --gc
+test -e $target/foobar
+
+# But now it should be gone.
+rm $TEST_ROOT/result
+$nixstore --gc
+if test -e $target/foobar; then false; fi
diff --git a/tests/nix-pull.sh b/tests/nix-pull.sh
index 146227b71aac..03dcdb21d506 100644
--- a/tests/nix-pull.sh
+++ b/tests/nix-pull.sh
@@ -36,4 +36,6 @@ cat $outPath/input-2/bar
 
 # Check that the derivers are set properly.
 test $($nixstore -q --deriver "$outPath") = "$drvPath"
-$nixstore -q --deriver $(/bin/ls -l $outPath/input-2 | sed 's/.*->\ //') | grep -q -- "-input-2.drv" 
+$nixstore -q --deriver $(ls -l $outPath/input-2 | sed 's/.*->\ //') | grep -q -- "-input-2.drv" 
+
+$nixstore --clear-substitutes