diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-03-17 16:33:48 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-03-17 16:33:48 +0000 |
commit | 2d5114452d8a8f73c858f9beb6bfaafe35e7bf9a (patch) | |
tree | 676ad5958bce42d91d09518cf44c61a6414ac0e2 /tests | |
parent | 33ecb4299107da91f5d61131ead37afabe496649 (diff) |
* Regression test for the `exportReferencesGraph'
derivation attribute.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 6 | ||||
-rw-r--r-- | tests/config.nix.in | 9 | ||||
-rw-r--r-- | tests/dependencies.builder0.sh | 2 | ||||
-rw-r--r-- | tests/dependencies.nix | 22 | ||||
-rw-r--r-- | tests/dependencies.nix.in | 29 | ||||
-rw-r--r-- | tests/export-graph.nix | 23 | ||||
-rw-r--r-- | tests/export-graph.sh | 9 | ||||
-rw-r--r-- | tests/logging.sh | 2 |
8 files changed, 69 insertions, 33 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index ab6ac426a..e61d4faa8 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 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: dependencies.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 @@ -19,7 +19,7 @@ TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \ fallback.sh nix-push.sh gc.sh gc-concurrent.sh verify.sh nix-pull.sh \ referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \ gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \ - remote-store.sh export.sh + remote-store.sh export.sh export-graph.sh XFAIL_TESTS = @@ -30,7 +30,7 @@ $(TESTS): common.sh EXTRA_DIST = $(TESTS) \ simple.nix.in simple.builder.sh \ hash-check.nix \ - dependencies.nix.in dependencies.builder*.sh \ + 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 \ diff --git a/tests/config.nix.in b/tests/config.nix.in new file mode 100644 index 000000000..a58295f98 --- /dev/null +++ b/tests/config.nix.in @@ -0,0 +1,9 @@ +{ + mkDerivation = args: + derivation ({ + system = "@system@"; + builder = "@shell@"; + args = ["-e" args.builder]; + PATH = "@testPath@"; + } // removeAttrs args ["builder"]); +} diff --git a/tests/dependencies.builder0.sh b/tests/dependencies.builder0.sh index dc0bd9a9b..ea4116d90 100644 --- a/tests/dependencies.builder0.sh +++ b/tests/dependencies.builder0.sh @@ -5,3 +5,5 @@ ln -s $input2 $out/input-2 # Self-reference. ln -s $out $out/self + +echo FOO diff --git a/tests/dependencies.nix b/tests/dependencies.nix new file mode 100644 index 000000000..a397e1ce4 --- /dev/null +++ b/tests/dependencies.nix @@ -0,0 +1,22 @@ +with import ./config.nix; + +let { + + input1 = mkDerivation { + name = "dependencies-input-1"; + builder = ./dependencies.builder1.sh; + }; + + input2 = mkDerivation { + name = "dependencies-input-2"; + builder = ./. ~ "dependencies.builder2.sh"; + }; + + body = mkDerivation { + name = "dependencies"; + builder = ./dependencies.builder0.sh + "/FOOBAR/../."; + input1 = input1 + "/."; + inherit input2; + }; + +} diff --git a/tests/dependencies.nix.in b/tests/dependencies.nix.in deleted file mode 100644 index c33c6a8d9..000000000 --- a/tests/dependencies.nix.in +++ /dev/null @@ -1,29 +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 = "dependencies"; - system = "@system@"; - builder = "@shell@"; - args = ["-e" "-x" (./dependencies.builder0.sh + "/FOOBAR/../.")]; - PATH = "@testPath@"; - input1 = input1 + "/."; - inherit input2; - }; - -}
\ No newline at end of file diff --git a/tests/export-graph.nix b/tests/export-graph.nix new file mode 100644 index 000000000..3e30d2dce --- /dev/null +++ b/tests/export-graph.nix @@ -0,0 +1,23 @@ +with import ./config.nix; + +rec { + + buildGraphBuilder = builtins.toFile "build-graph-builder" + '' + #cat refs + while read path; do + read drv + read nrRefs + echo "$path has $nrRefs references" + echo -n "$path" >> $out + for ((n = 0; n < $nrRefs; n++)); do read ref; echo "ref $ref"; done + done < refs + ''; + + buildGraph = mkDerivation { + name = "dependencies"; + builder = buildGraphBuilder; + exportReferencesGraph = ["refs" (import ./dependencies.nix)]; + }; + +} diff --git a/tests/export-graph.sh b/tests/export-graph.sh new file mode 100644 index 000000000..f31bc75ab --- /dev/null +++ b/tests/export-graph.sh @@ -0,0 +1,9 @@ +source common.sh + +clearStore +clearProfiles + +outPath=$($nixbuild ./export-graph.nix) + +test $(nix-store -q --references ./result | wc -l) = 2 || fail "bad nr of references" +nix-store -q --references ./result | grep -q input-2 || fail "missing reference" diff --git a/tests/logging.sh b/tests/logging.sh index 585bce2db..60e2e1234 100644 --- a/tests/logging.sh +++ b/tests/logging.sh @@ -19,5 +19,5 @@ if test "$xsltproc" != "false"; then # Ideally we would check that the generated HTML is valid... # A few checks... - grep "<li>.*<code>.*echo FOO" $TEST_ROOT/log.html + grep "<li>.*<code>.*FOO" $TEST_ROOT/log.html fi |