From 51e7e32c3bf7c2fb5045b0655c2edc1fbf347455 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 17 Mar 2009 17:11:55 +0000 Subject: [PATCH] * Refactoring: renamed *.nix.in to *.nix. --- tests/Makefile.am | 36 ++++------- tests/build-hook.nix | 21 +++++++ tests/build-hook.nix.in | 28 --------- tests/check-refs.nix | 58 ++++++++++++++++++ tests/check-refs.nix.in | 59 ------------------- tests/config.nix.in | 16 +++-- tests/export-graph.nix | 1 - ...filter-source.nix.in => filter-source.nix} | 8 +-- tests/{fixed.nix.in => fixed.nix} | 9 ++- tests/gc-concurrent.nix | 27 +++++++++ tests/gc-concurrent.nix.in | 28 --------- tests/gc-concurrent.sh | 4 +- tests/gc-concurrent2.nix.in | 28 --------- tests/gc-runtime.nix | 17 ++++++ tests/gc-runtime.nix.in | 23 -------- tests/locking.nix | 17 ++++++ tests/locking.nix.in | 19 ------ tests/parallel.nix | 17 ++++++ tests/parallel.nix.in | 20 ------- tests/simple.nix | 8 +++ tests/simple.nix.in | 7 --- tests/{user-envs.nix.in => user-envs.nix} | 22 ++++--- 22 files changed, 209 insertions(+), 264 deletions(-) create mode 100644 tests/build-hook.nix delete mode 100644 tests/build-hook.nix.in create mode 100644 tests/check-refs.nix delete mode 100644 tests/check-refs.nix.in rename tests/{filter-source.nix.in => filter-source.nix} (62%) rename tests/{fixed.nix.in => fixed.nix} (90%) create mode 100644 tests/gc-concurrent.nix delete mode 100644 tests/gc-concurrent.nix.in delete mode 100644 tests/gc-concurrent2.nix.in create mode 100644 tests/gc-runtime.nix delete mode 100644 tests/gc-runtime.nix.in create mode 100644 tests/locking.nix delete mode 100644 tests/locking.nix.in create mode 100644 tests/parallel.nix delete mode 100644 tests/parallel.nix.in create mode 100644 tests/simple.nix delete mode 100644 tests/simple.nix.in rename tests/{user-envs.nix.in => user-envs.nix} (58%) diff --git a/tests/Makefile.am b/tests/Makefile.am index e61d4faa8..cad41d052 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 000000000..e4954537f --- /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 697cab81e..000000000 --- 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 000000000..63791fe16 --- /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 a3738fa43..000000000 --- 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 a58295f98..2bfee8b44 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 3e30d2dce..b7afa2a85 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 similarity index 62% rename from tests/filter-source.nix.in rename to tests/filter-source.nix index 6fd494794..a620f0fda 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 similarity index 90% rename from tests/fixed.nix.in rename to tests/fixed.nix index ad5306cf6..76580ffa1 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 000000000..c0595cc47 --- /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 cf9f67313..000000000 --- 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 fbc949720..8ae511e4f 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 d331e9c82..000000000 --- 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 000000000..ee5980bdf --- /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 < $out/program <