about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-05-04T13·22+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-05-04T13·22+0000
commita7bbe739717c7419a374b29e6e4887325b1af7fd (patch)
treea24f54f2b71cba90e9d681e55fc351b8795e4550
parentef093aac8f24535f6d0c75332ac7aeafbbe8c161 (diff)
* Another test.
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/dependencies.builder0.sh6
-rw-r--r--tests/dependencies.builder1.sh4
-rw-r--r--tests/dependencies.builder2.sh4
-rw-r--r--tests/dependencies.nix.in25
-rw-r--r--tests/dependencies.sh23
6 files changed, 66 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7c62f9025214..2119221bbcc2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,10 +10,12 @@ TESTS_ENVIRONMENT = TEST_ROOT=$(TEST_ROOT) \
   $(SHELL) -e -x
 
 simple.sh: simple.nix
+dependencies.sh: dependencies.nix
 
-TESTS = init.sh simple.sh
+TESTS = init.sh simple.sh dependencies.sh
 
 include ../substitute.mk
 
 EXTRA_DIST = $(TESTS) \
-  simple.nix.in simple.builder.sh
+  simple.nix.in simple.builder.sh \
+  dependencies.nix.in dependencies.builder*.sh
diff --git a/tests/dependencies.builder0.sh b/tests/dependencies.builder0.sh
new file mode 100644
index 000000000000..326e8dfbb8d3
--- /dev/null
+++ b/tests/dependencies.builder0.sh
@@ -0,0 +1,6 @@
+export PATH=/bin:/usr/bin:$PATH
+
+mkdir $out
+echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar
+
+ln -s $input2 $out/input-2
\ No newline at end of file
diff --git a/tests/dependencies.builder1.sh b/tests/dependencies.builder1.sh
new file mode 100644
index 000000000000..53cd73916c36
--- /dev/null
+++ b/tests/dependencies.builder1.sh
@@ -0,0 +1,4 @@
+export PATH=/bin:/usr/bin:$PATH
+
+mkdir $out
+echo FOO > $out/foo
diff --git a/tests/dependencies.builder2.sh b/tests/dependencies.builder2.sh
new file mode 100644
index 000000000000..baceae756ddb
--- /dev/null
+++ b/tests/dependencies.builder2.sh
@@ -0,0 +1,4 @@
+export PATH=/bin:/usr/bin:$PATH
+
+mkdir $out
+echo BAR > $out/bar
diff --git a/tests/dependencies.nix.in b/tests/dependencies.nix.in
new file mode 100644
index 000000000000..920564955a53
--- /dev/null
+++ b/tests/dependencies.nix.in
@@ -0,0 +1,25 @@
+let {
+
+  input1 = derivation {
+    name = "dependencies-input-1";
+    system = "@system@";
+    builder = "@shell@";
+    args = ["-e" "-x" ./dependencies.builder1.sh];
+  };
+
+  input2 = derivation {
+    name = "dependencies-input-2";
+    system = "@system@";
+    builder = "@shell@";
+    args = ["-e" "-x" ./dependencies.builder2.sh];
+  };
+
+  body = derivation {
+    name = "dependencies";
+    system = "@system@";
+    builder = "@shell@";
+    args = ["-e" "-x" ./dependencies.builder0.sh];
+    inherit input1 input2;
+  };
+
+}
\ No newline at end of file
diff --git a/tests/dependencies.sh b/tests/dependencies.sh
new file mode 100644
index 000000000000..8a0ba1f2a15e
--- /dev/null
+++ b/tests/dependencies.sh
@@ -0,0 +1,23 @@
+storeExpr=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix)
+
+echo "store expr is $storeExpr"
+
+outPath=$($TOP/src/nix-store/nix-store -qnfvvvvv "$storeExpr")
+
+echo "output path is $outPath"
+
+text=$(cat "$outPath"/foobar)
+if test "$text" != "FOOBAR"; then exit 1; fi
+
+deps=$($TOP/src/nix-store/nix-store -qnR "$storeExpr")
+
+echo "output closures are $deps"
+
+# The output path should be in the closure.
+echo "$deps" | grep -q "$outPath"
+
+# Input-1 is not retained.
+if echo "$deps" | grep -q "dependencies-input-1"; then exit 1; fi
+
+# Input-2 is retained.
+echo "$deps" | grep -q "dependencies-input-2"