about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.am36
-rw-r--r--tests/build-hook.nix21
-rw-r--r--tests/build-hook.nix.in28
-rw-r--r--tests/check-refs.nix58
-rw-r--r--tests/check-refs.nix.in59
-rw-r--r--tests/config.nix.in16
-rw-r--r--tests/export-graph.nix1
-rw-r--r--tests/filter-source.nix (renamed from tests/filter-source.nix.in)8
-rw-r--r--tests/fixed.nix (renamed from tests/fixed.nix.in)9
-rw-r--r--tests/gc-concurrent.nix27
-rw-r--r--tests/gc-concurrent.nix.in28
-rw-r--r--tests/gc-concurrent.sh4
-rw-r--r--tests/gc-concurrent2.nix.in28
-rw-r--r--tests/gc-runtime.nix17
-rw-r--r--tests/gc-runtime.nix.in23
-rw-r--r--tests/locking.nix17
-rw-r--r--tests/locking.nix.in19
-rw-r--r--tests/parallel.nix17
-rw-r--r--tests/parallel.nix.in20
-rw-r--r--tests/simple.nix8
-rw-r--r--tests/simple.nix.in7
-rw-r--r--tests/user-envs.nix (renamed from tests/user-envs.nix.in)22
22 files changed, 209 insertions, 264 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e61d4faa85..cad41d0526 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,18 +2,6 @@ TESTS_ENVIRONMENT = $(SHELL) -e
 
 extra1 = $(shell pwd)/test-tmp/shared
 
-simple.sh substitutes.sh substitutes2.sh fallback.sh: simple.nix
-dependencies.sh gc.sh nix-push.sh nix-pull.in logging.sh nix-build.sh install-package.sh check-refs.sh export-graph.sh: config.nix
-locking.sh: locking.nix
-parallel.sh: parallel.nix
-build-hook.sh: build-hook.nix
-gc-concurrent.sh: gc-concurrent.nix gc-concurrent2.nix simple.nix
-user-envs.sh: user-envs.nix
-fixed.sh: fixed.nix
-gc-runtime.sh: gc-runtime.nix
-check-refs.sh: check-refs.nix
-filter-source.sh: filter-source.nix
-
 TESTS = init.sh hash.sh lang.sh add.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 \
@@ -25,22 +13,22 @@ XFAIL_TESTS =
 
 include ../substitute.mk
 
-$(TESTS): common.sh
+$(TESTS): common.sh config.nix
 
 EXTRA_DIST = $(TESTS) \
-  simple.nix.in simple.builder.sh \
+  simple.nix simple.builder.sh \
   hash-check.nix \
   dependencies.nix dependencies.builder*.sh \
-  locking.nix.in locking.builder.sh \
-  parallel.nix.in parallel.builder.sh \
-  build-hook.nix.in build-hook.hook.sh \
+  locking.nix locking.builder.sh \
+  parallel.nix parallel.builder.sh \
+  build-hook.nix build-hook.hook.sh \
   substituter.sh substituter2.sh \
-  gc-concurrent.nix.in gc-concurrent.builder.sh \
-  gc-concurrent2.nix.in gc-concurrent2.builder.sh \
-  user-envs.nix.in user-envs.builder.sh \
-  fixed.nix.in fixed.builder1.sh fixed.builder2.sh \
-  gc-runtime.nix.in \
-  check-refs.nix.in \
-  filter-source.nix.in \
+  gc-concurrent.nix gc-concurrent.builder.sh gc-concurrent2.builder.sh \
+  user-envs.nix user-envs.builder.sh \
+  fixed.nix fixed.builder1.sh fixed.builder2.sh \
+  gc-runtime.nix \
+  check-refs.nix \
+  filter-source.nix \
+  export-graph.nix \
   $(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) \
   common.sh.in
diff --git a/tests/build-hook.nix b/tests/build-hook.nix
new file mode 100644
index 0000000000..e4954537f3
--- /dev/null
+++ b/tests/build-hook.nix
@@ -0,0 +1,21 @@
+with import ./config.nix;
+
+let
+
+  input1 = mkDerivation {
+    name = "build-hook-input-1";
+    builder = ./dependencies.builder1.sh;
+  };
+
+  input2 = mkDerivation {
+    name = "build-hook-input-2";
+    builder = ./dependencies.builder2.sh;
+  };
+
+in
+
+  mkDerivation {
+    name = "build-hook";
+    builder = ./dependencies.builder0.sh;
+    inherit input1 input2;
+  }
diff --git a/tests/build-hook.nix.in b/tests/build-hook.nix.in
deleted file mode 100644
index 697cab81e1..0000000000
--- a/tests/build-hook.nix.in
+++ /dev/null
@@ -1,28 +0,0 @@
-let {
-
-  input1 = derivation {
-    name = "build-hook-input-1";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./dependencies.builder1.sh];
-    PATH = "@testPath@";
-  };
-
-  input2 = derivation {
-    name = "build-hook-input-2";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./dependencies.builder2.sh];
-    PATH = "@testPath@";
-  };
-
-  body = derivation {
-    name = "build-hook";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./dependencies.builder0.sh];
-    PATH = "@testPath@";
-    inherit input1 input2;
-  };
-
-}
\ No newline at end of file
diff --git a/tests/check-refs.nix b/tests/check-refs.nix
new file mode 100644
index 0000000000..63791fe160
--- /dev/null
+++ b/tests/check-refs.nix
@@ -0,0 +1,58 @@
+with import ./config.nix;
+
+rec {
+
+  dep = import ./dependencies.nix;
+
+  makeTest = nr: args: mkDerivation ({
+    name = "check-refs-" + toString nr;
+  } // args);
+
+  src = builtins.toFile "aux-ref" "bla bla";
+
+  test1 = makeTest 1 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
+    inherit dep;
+  };
+
+  test2 = makeTest 2 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s ${src} $out/link";
+    inherit dep;
+  };
+
+  test3 = makeTest 3 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
+    allowedReferences = [];
+    inherit dep;
+  };
+
+  test4 = makeTest 4 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link";
+    allowedReferences = [dep];
+    inherit dep;
+  };
+
+  test5 = makeTest 5 {
+    builder = builtins.toFile "builder.sh" "mkdir $out";
+    allowedReferences = [];
+    inherit dep;
+  };
+
+  test6 = makeTest 6 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link";
+    allowedReferences = [];
+    inherit dep;
+  };
+
+  test7 = makeTest 7 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link";
+    allowedReferences = ["out"];
+    inherit dep;
+  };
+
+  test8 = makeTest 8 {
+    builder = builtins.toFile "builder.sh" "mkdir $out; ln -s ${test1} $out/link";
+    inherit dep;
+  };
+
+}
diff --git a/tests/check-refs.nix.in b/tests/check-refs.nix.in
deleted file mode 100644
index a3738fa43d..0000000000
--- a/tests/check-refs.nix.in
+++ /dev/null
@@ -1,59 +0,0 @@
-rec {
-
-  dep = import ./dependencies.nix;
-
-  makeTest = nr: args: derivation ({
-    name = "check-refs-" + toString nr;
-    system = "@system@";
-    builder = "@shell@";
-    PATH = "@testPath@";
-  } // args);
-
-  src = builtins.toFile "aux-ref" "bla bla";
-
-  test1 = makeTest 1 {
-    args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link")];
-    inherit dep;
-  };
-
-  test2 = makeTest 2 {
-    args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s ${src} $out/link")];
-    inherit dep;
-  };
-
-  test3 = makeTest 3 {
-    args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link")];
-    allowedReferences = [];
-    inherit dep;
-  };
-
-  test4 = makeTest 4 {
-    args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $dep $out/link")];
-    allowedReferences = [dep];
-    inherit dep;
-  };
-
-  test5 = makeTest 5 {
-    args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out")];
-    allowedReferences = [];
-    inherit dep;
-  };
-
-  test6 = makeTest 6 {
-    args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link")];
-    allowedReferences = [];
-    inherit dep;
-  };
-
-  test7 = makeTest 7 {
-    args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s $out $out/link")];
-    allowedReferences = ["out"];
-    inherit dep;
-  };
-
-  test8 = makeTest 8 {
-    args = ["-e" "-x" (builtins.toFile "builder.sh" "mkdir $out; ln -s ${test1} $out/link")];
-    inherit dep;
-  };
-
-}
diff --git a/tests/config.nix.in b/tests/config.nix.in
index a58295f982..2bfee8b44b 100644
--- a/tests/config.nix.in
+++ b/tests/config.nix.in
@@ -1,9 +1,17 @@
-{
+rec {
+  shell = "@shell@";
+
+  path = "@testPath@";
+
+  system = "@system@";
+
+  shared = "@extra1@";
+    
   mkDerivation = args:
     derivation ({
-      system = "@system@";
-      builder = "@shell@";
+      inherit system;
+      builder = shell;
       args = ["-e" args.builder];
-      PATH = "@testPath@";
+      PATH = path;
     } // removeAttrs args ["builder"]);
 }
diff --git a/tests/export-graph.nix b/tests/export-graph.nix
index 3e30d2dcea..b7afa2a85b 100644
--- a/tests/export-graph.nix
+++ b/tests/export-graph.nix
@@ -4,7 +4,6 @@ rec {
 
   buildGraphBuilder = builtins.toFile "build-graph-builder"
     ''
-      #cat refs
       while read path; do
           read drv
           read nrRefs
diff --git a/tests/filter-source.nix.in b/tests/filter-source.nix
index 6fd494794e..a620f0fda5 100644
--- a/tests/filter-source.nix.in
+++ b/tests/filter-source.nix
@@ -1,8 +1,8 @@
-derivation {
+with import ./config.nix;
+
+mkDerivation {
   name = "filter";
-  system = "@system@";
-  builder = "@shell@";
-  args = ["-e" "-x" (builtins.toFile "builder" "PATH=@testPath@; ln -s $input $out")];
+  builder = builtins.toFile "builder" "ln -s $input $out";
   input =
     let filter = path: type:
       type != "symlink"
diff --git a/tests/fixed.nix.in b/tests/fixed.nix
index ad5306cf6a..76580ffa19 100644
--- a/tests/fixed.nix.in
+++ b/tests/fixed.nix
@@ -1,14 +1,13 @@
+with import ./config.nix;
+
 rec {
 
-  f2 = dummy: builder: mode: algo: hash: derivation {
+  f2 = dummy: builder: mode: algo: hash: mkDerivation {
     name = "fixed";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" builder];
+    inherit builder;
     outputHashMode = mode;
     outputHashAlgo = algo;
     outputHash = hash;
-    PATH = "@testPath@";
     inherit dummy;
     impureEnvVars = ["IMPURE_VAR1" "IMPURE_VAR2"];
   };
diff --git a/tests/gc-concurrent.nix b/tests/gc-concurrent.nix
new file mode 100644
index 0000000000..c0595cc471
--- /dev/null
+++ b/tests/gc-concurrent.nix
@@ -0,0 +1,27 @@
+with import ./config.nix;
+
+rec {
+
+  input1 = mkDerivation {
+    name = "dependencies-input-1";
+    builder = ./dependencies.builder1.sh;
+  };
+
+  input2 = mkDerivation {
+    name = "dependencies-input-2";
+    builder = ./dependencies.builder2.sh;
+  };
+
+  test1 = mkDerivation {
+    name = "gc-concurrent";
+    builder = ./gc-concurrent.builder.sh;
+    inherit input1 input2;
+  };
+
+  test2 = mkDerivation {
+    name = "gc-concurrent2";
+    builder = ./gc-concurrent2.builder.sh;
+    inherit input1 input2;
+  };
+  
+}
diff --git a/tests/gc-concurrent.nix.in b/tests/gc-concurrent.nix.in
deleted file mode 100644
index cf9f673137..0000000000
--- a/tests/gc-concurrent.nix.in
+++ /dev/null
@@ -1,28 +0,0 @@
-let {
-
-  input1 = derivation {
-    name = "dependencies-input-1";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./dependencies.builder1.sh];
-    PATH = "@testPath@";
-  };
-
-  input2 = derivation {
-    name = "dependencies-input-2";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./dependencies.builder2.sh];
-    PATH = "@testPath@";
-  };
-
-  body = derivation {
-    name = "gc-concurrent";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./gc-concurrent.builder.sh];
-    PATH = "@testPath@";
-    inherit input1 input2;
-  };
-
-}
\ No newline at end of file
diff --git a/tests/gc-concurrent.sh b/tests/gc-concurrent.sh
index fbc9497206..8ae511e4fa 100644
--- a/tests/gc-concurrent.sh
+++ b/tests/gc-concurrent.sh
@@ -2,10 +2,10 @@ source common.sh
 
 $NIX_BIN_DIR/nix-collect-garbage -vvvvv
 
-drvPath1=$($nixinstantiate gc-concurrent.nix)
+drvPath1=$($nixinstantiate gc-concurrent.nix -A test1)
 outPath1=$($nixstore -q $drvPath1)
 
-drvPath2=$($nixinstantiate gc-concurrent2.nix)
+drvPath2=$($nixinstantiate gc-concurrent.nix -A test2)
 outPath2=$($nixstore -q $drvPath2)
 
 drvPath3=$($nixinstantiate simple.nix)
diff --git a/tests/gc-concurrent2.nix.in b/tests/gc-concurrent2.nix.in
deleted file mode 100644
index d331e9c82d..0000000000
--- a/tests/gc-concurrent2.nix.in
+++ /dev/null
@@ -1,28 +0,0 @@
-let {
-
-  input1 = derivation {
-    name = "dependencies-input-1";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./dependencies.builder1.sh];
-    PATH = "@testPath@";
-  };
-
-  input2 = derivation {
-    name = "dependencies-input-2";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./dependencies.builder2.sh];
-    PATH = "@testPath@";
-  };
-
-  body = derivation {
-    name = "gc-concurrent2";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./gc-concurrent2.builder.sh];
-    PATH = "@testPath@";
-    inherit input1 input2;
-  };
-
-}
\ No newline at end of file
diff --git a/tests/gc-runtime.nix b/tests/gc-runtime.nix
new file mode 100644
index 0000000000..ee5980bdff
--- /dev/null
+++ b/tests/gc-runtime.nix
@@ -0,0 +1,17 @@
+with import ./config.nix;
+
+mkDerivation {
+  name = "gc-runtime";
+  builder =
+    # Test inline source file definitions.
+    builtins.toFile "builder.sh" ''
+      mkdir $out
+
+      cat > $out/program <<EOF
+      #! ${shell}
+      sleep 10000
+      EOF
+
+      chmod +x $out/program
+    '';
+}
diff --git a/tests/gc-runtime.nix.in b/tests/gc-runtime.nix.in
deleted file mode 100644
index 310d44ce8b..0000000000
--- a/tests/gc-runtime.nix.in
+++ /dev/null
@@ -1,23 +0,0 @@
-let {
-
-  # Test inline source file definitions.
-  builder = builtins.toFile "builder.sh" "
-mkdir $out
-
-cat > $out/program <<EOF
-#! @shell@
-sleep 10000
-EOF
-
-chmod +x $out/program
-";
-
-  body = derivation {
-    name = "gc-runtime";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" builder];
-    PATH = "@testPath@";
-  };
-
-}
diff --git a/tests/locking.nix b/tests/locking.nix
new file mode 100644
index 0000000000..a0407685b3
--- /dev/null
+++ b/tests/locking.nix
@@ -0,0 +1,17 @@
+with import ./config.nix;
+
+let
+
+  mkDrv = text: inputs: mkDerivation {
+    name = "locking";
+    builder = ./locking.builder.sh;
+    inherit text inputs;
+  };
+
+  a = mkDrv "a" [];
+  b = mkDrv "b" [a];
+  c = mkDrv "c" [a b];
+  d = mkDrv "d" [a];
+  e = mkDrv "e" [c d];
+
+in e
diff --git a/tests/locking.nix.in b/tests/locking.nix.in
deleted file mode 100644
index a6b6b9101d..0000000000
--- a/tests/locking.nix.in
+++ /dev/null
@@ -1,19 +0,0 @@
-let {
-
-  mkDrv = text: inputs: derivation {
-    name = "locking";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./locking.builder.sh];
-    PATH = "@testPath@";
-    inherit text inputs;
-  };
-
-  a = mkDrv "a" [];
-  b = mkDrv "b" [a];
-  c = mkDrv "c" [a b];
-  d = mkDrv "d" [a];
-  e = mkDrv "e" [c d];
-
-  body = e;
-}
\ No newline at end of file
diff --git a/tests/parallel.nix b/tests/parallel.nix
new file mode 100644
index 0000000000..eb5dd02c01
--- /dev/null
+++ b/tests/parallel.nix
@@ -0,0 +1,17 @@
+with import ./config.nix;
+
+let
+
+  mkDrv = text: inputs: mkDerivation {
+    name = "parallel";
+    builder = ./parallel.builder.sh;
+    inherit text inputs shared;
+  };
+
+  a = mkDrv "a" [];
+  b = mkDrv "b" [a];
+  c = mkDrv "c" [a];
+  d = mkDrv "d" [a];
+  e = mkDrv "e" [b c d];
+
+in e
diff --git a/tests/parallel.nix.in b/tests/parallel.nix.in
deleted file mode 100644
index 3b462c4b24..0000000000
--- a/tests/parallel.nix.in
+++ /dev/null
@@ -1,20 +0,0 @@
-let {
-
-  mkDrv = text: inputs: derivation {
-    name = "parallel";
-    system = "@system@";
-    builder = "@shell@";
-    args = ["-e" "-x" ./parallel.builder.sh];
-    PATH = "@testPath@";
-    shared = "@extra1@";
-    inherit text inputs;
-  };
-
-  a = mkDrv "a" [];
-  b = mkDrv "b" [a];
-  c = mkDrv "c" [a];
-  d = mkDrv "d" [a];
-  e = mkDrv "e" [b c d];
-
-  body = e;
-}
diff --git a/tests/simple.nix b/tests/simple.nix
new file mode 100644
index 0000000000..4223c0f23a
--- /dev/null
+++ b/tests/simple.nix
@@ -0,0 +1,8 @@
+with import ./config.nix;
+
+mkDerivation {
+  name = "simple";
+  builder = ./simple.builder.sh;
+  PATH = "";
+  goodPath = path;
+}
diff --git a/tests/simple.nix.in b/tests/simple.nix.in
deleted file mode 100644
index b49a8ca58e..0000000000
--- a/tests/simple.nix.in
+++ /dev/null
@@ -1,7 +0,0 @@
-derivation {
-  name = "simple";
-  system = "@system@";
-  builder = "@shell@";
-  args = ["-e" "-x" ./simple.builder.sh];
-  goodPath = "@testPath@";
-}
diff --git a/tests/user-envs.nix.in b/tests/user-envs.nix
index 7972dfea1c..e2afd92f00 100644
--- a/tests/user-envs.nix.in
+++ b/tests/user-envs.nix
@@ -1,30 +1,28 @@
 # Some dummy arguments...
-{ system ? "@system@"
-, foo ? "foo"
+{ foo ? "foo"
 }:
 
+with import ./config.nix;
+
 assert foo == "foo";
 
-let {
+let
 
-  makeDrv = name: progName: (derivation {
+  makeDrv = name: progName: (mkDerivation {
     inherit name progName system;
-    builder = "@shell@";
-    shell = "@shell@";
-    args = ["-e" "-x" ./user-envs.builder.sh];
-    PATH = "@testPath@";
+    builder = ./user-envs.builder.sh;
   } // {
     meta = {
       description = "A silly test package";
     };
   });
 
-  body = [
+in
+
+  [
     (makeDrv "foo-1.0" "foo")
     (makeDrv "foo-2.0pre1" "foo")
     (makeDrv "bar-0.1" "bar")
     (makeDrv "foo-2.0" "foo")
     (makeDrv "bar-0.1.1" "bar")
-  ];
-  
-}
+  ]