about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-05-12T09·35+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-05-12T09·35+0000
commit8c0b42f857b53993d95c5bc077e8f8a71028c5ac (patch)
tree8911f759371585a66cfd6b5ad604fff0a97779ba /tests
parentc8d3882cdc8f9e22c58af285c1996265c1af75d5 (diff)
* An quick and dirty hack to support distributed builds.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/build-hook.hook.sh17
-rw-r--r--tests/build-hook.nix.in25
-rw-r--r--tests/build-hook.sh12
4 files changed, 59 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 14662c20d4..608ffec19c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,8 +16,10 @@ simple.sh: simple.nix
 dependencies.sh: dependencies.nix
 locking.sh: locking.nix
 parallel.sh: parallel.nix
+build-hook.sh: build-hook.nix
 
-TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh
+TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \
+  build-hook.sh
 
 XFAIL_TESTS =
 
@@ -27,4 +29,5 @@ EXTRA_DIST = $(TESTS) \
   simple.nix.in simple.builder.sh \
   dependencies.nix.in dependencies.builder*.sh \
   locking.nix.in locking.builder.sh \
-  parallel.nix.in parallel.builder.sh
+  parallel.nix.in parallel.builder.sh \
+  build-hook.nix.in
diff --git a/tests/build-hook.hook.sh b/tests/build-hook.hook.sh
new file mode 100644
index 0000000000..7176315d9d
--- /dev/null
+++ b/tests/build-hook.hook.sh
@@ -0,0 +1,17 @@
+set -x
+
+drv=$1
+
+echo "HOOK for $drv"
+
+outPath=$(sed 's/Derive(\[\"\([^\"]*\)\".*/\1/' $drv)
+
+echo "output path is $outPath"
+
+if $(echo $outPath | grep -q input-1); then
+    mkdir $outPath
+    echo "BAR" > $outPath/foo
+    exit 100
+fi
+
+exit 101
\ No newline at end of file
diff --git a/tests/build-hook.nix.in b/tests/build-hook.nix.in
new file mode 100644
index 0000000000..920564955a
--- /dev/null
+++ b/tests/build-hook.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/build-hook.sh b/tests/build-hook.sh
new file mode 100644
index 0000000000..bd74e42fe3
--- /dev/null
+++ b/tests/build-hook.sh
@@ -0,0 +1,12 @@
+export NIX_BUILD_HOOK="sh build-hook.hook.sh"
+
+storeExpr=$($TOP/src/nix-instantiate/nix-instantiate build-hook.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" != "BARBAR"; then exit 1; fi