diff options
author | Shea Levy <shea@shealevy.com> | 2011-09-14 05:59:29 +0000 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2011-09-14 05:59:29 +0000 |
commit | 8f28a3ba25dd0dad6411a039bc01ad87c61a6e59 (patch) | |
tree | 1281600c0122c44543c8ac17a80a7bf63fe10d2c | |
parent | c172d16b00dd2126eb7c4f12c26f1e30e4356f07 (diff) |
Add a test for multiple outputs
This currently fails. Yay test-driven development!
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/multiple-outputs.a.builder.sh | 6 | ||||
-rw-r--r-- | tests/multiple-outputs.b.builder.sh | 7 | ||||
-rw-r--r-- | tests/multiple-outputs.nix | 23 | ||||
-rw-r--r-- | tests/multiple-outputs.sh | 15 |
5 files changed, 54 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 676a9c387..0418f73e6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,7 +8,7 @@ TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.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 export-graph.sh negative-caching.sh \ - binary-patching.sh timeout.sh secure-drv-outputs.sh + binary-patching.sh timeout.sh secure-drv-outputs.sh multiple-outputs.sh XFAIL_TESTS = @@ -35,6 +35,8 @@ EXTRA_DIST = $(TESTS) \ binary-patching.nix \ timeout.nix timeout.builder.sh \ secure-drv-outputs.nix \ + multiple-outputs.nix \ + multiple-outputs.a.builder.sh multiple-outputs.b.builder.sh \ $(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) $(wildcard lang/dir*/*.nix) \ common.sh.in diff --git a/tests/multiple-outputs.a.builder.sh b/tests/multiple-outputs.a.builder.sh new file mode 100644 index 000000000..657b7ea0a --- /dev/null +++ b/tests/multiple-outputs.a.builder.sh @@ -0,0 +1,6 @@ +mkdir $first +mkdir $second +test -z $all + +echo "second" > $first/file +echo "first" > $second/file diff --git a/tests/multiple-outputs.b.builder.sh b/tests/multiple-outputs.b.builder.sh new file mode 100644 index 000000000..bc63fc068 --- /dev/null +++ b/tests/multiple-outputs.b.builder.sh @@ -0,0 +1,7 @@ +mkdir $out +test "$firstOutput $secondOutput" = "$allOutputs" +test "$defaultOutput" = "$firstOutput" +test "$(cat $first/file)" = "second" +test "$(cat $second/file)" = "first" + +echo "success" > $out/file diff --git a/tests/multiple-outputs.nix b/tests/multiple-outputs.nix new file mode 100644 index 000000000..e8fbf91bf --- /dev/null +++ b/tests/multiple-outputs.nix @@ -0,0 +1,23 @@ +with import ./config.nix; + +let + + a = mkDerivation { + name = "multiple-outputs-a"; + outputs = [ "first" "second" ]; + builder = ./multiple-outputs.a.builder.sh; + helloString = "Hello, world!"; + }; + +in + +assert a.second.helloString == "Hello, world!"; + +mkDerivation { + defaultOutput = a; + firstOutput = a.first.first; + secondOutput = a.second.first.first.second.second.first.second; + allOutputs = a.all; + name = "multiple-outputs-b"; + builder = ./multiple-outputs.b.builder.sh; +} diff --git a/tests/multiple-outputs.sh b/tests/multiple-outputs.sh new file mode 100644 index 000000000..f4cd01234 --- /dev/null +++ b/tests/multiple-outputs.sh @@ -0,0 +1,15 @@ +source common.sh + +echo "Testing multiple outputs..." + +drvPath=$($nixinstantiate multiple-outputs.nix) + +echo "derivation is $drvPath" + +outPath=$($nixstore -rvv "$drvPath") + +echo "output path is $outPath" + +text=$(cat "$outPath"/file) +if test "$text" != "success"; then exit 1; fi + |