aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-12-20 17:01:02 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-12-20 17:01:02 +0000
commit46e42c92c1444e1dd3aec871b3750bcd7391f60e (patch)
tree1713c3f6a57f264c54b687d5a3f93afaa1aed021
parentb5363810bbeea37df34a5cb0051e05161630a510 (diff)
* Refactor a bit so that more tests can be added.
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/multiple-outputs.a.builder.sh6
-rw-r--r--tests/multiple-outputs.b.builder.sh7
-rw-r--r--tests/multiple-outputs.nix36
-rw-r--r--tests/multiple-outputs.sh12
5 files changed, 26 insertions, 36 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8b5aa4bd9..70352dbb5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -36,7 +36,6 @@ EXTRA_DIST = $(TESTS) \
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
deleted file mode 100644
index 657b7ea0a..000000000
--- a/tests/multiple-outputs.a.builder.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-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
deleted file mode 100644
index acf939062..000000000
--- a/tests/multiple-outputs.b.builder.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-mkdir $out
-test "$firstOutput $secondOutput" = "$allOutputs"
-test "$defaultOutput" = "$firstOutput"
-test "$(cat $firstOutput/file)" = "second"
-test "$(cat $secondOutput/file)" = "first"
-
-echo "success" > $out/file
diff --git a/tests/multiple-outputs.nix b/tests/multiple-outputs.nix
index e8fbf91bf..a4cf0caea 100644
--- a/tests/multiple-outputs.nix
+++ b/tests/multiple-outputs.nix
@@ -1,23 +1,35 @@
with import ./config.nix;
-let
+rec {
a = mkDerivation {
name = "multiple-outputs-a";
outputs = [ "first" "second" ];
- builder = ./multiple-outputs.a.builder.sh;
+ builder = builtins.toFile "builder.sh"
+ ''
+ mkdir $first $second
+ test -z $all
+ echo "second" > $first/file
+ echo "first" > $second/file
+ '';
helloString = "Hello, world!";
};
-in
-
-assert a.second.helloString == "Hello, world!";
+ b = mkDerivation {
+ defaultOutput = assert a.second.helloString == "Hello, world!"; a;
+ firstOutput = a.first.first;
+ secondOutput = a.second.first.first.second.second.first.second;
+ allOutputs = a.all;
+ name = "multiple-outputs-b";
+ builder = builtins.toFile "builder.sh"
+ ''
+ mkdir $out
+ test "$firstOutput $secondOutput" = "$allOutputs"
+ test "$defaultOutput" = "$firstOutput"
+ test "$(cat $firstOutput/file)" = "second"
+ test "$(cat $secondOutput/file)" = "first"
+ echo "success" > $out/file
+ '';
+ };
-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
index d3ebdbea3..dadd2e25f 100644
--- a/tests/multiple-outputs.sh
+++ b/tests/multiple-outputs.sh
@@ -2,14 +2,6 @@ source common.sh
echo "Testing multiple outputs..."
-drvPath=$(nix-instantiate multiple-outputs.nix)
-
-echo "derivation is $drvPath"
-
-outPath=$(nix-store -rvv "$drvPath")
-
+outPath=$(nix-build multiple-outputs.nix -A b)
echo "output path is $outPath"
-
-text=$(cat "$outPath"/file)
-if test "$text" != "success"; then exit 1; fi
-
+[ "$(cat "$outPath"/file)" = "success" ]