aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/build.sh15
-rw-r--r--tests/multiple-outputs.nix16
-rw-r--r--tests/multiple-outputs.sh3
3 files changed, 24 insertions, 10 deletions
diff --git a/tests/build.sh b/tests/build.sh
index 036fb037e..a00fb5232 100644
--- a/tests/build.sh
+++ b/tests/build.sh
@@ -42,20 +42,21 @@ nix build -f multiple-outputs.nix --json 'a^*' --no-link | jq --exit-status '
nix build -f multiple-outputs.nix --json e --no-link | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-e.drv")) and
- (.outputs | keys == ["a", "b"]))
+ (.outputs | keys == ["a_a", "b"]))
'
# But not when it's overriden.
-nix build -f multiple-outputs.nix --json e^a --no-link | jq --exit-status '
+nix build -f multiple-outputs.nix --json e^a_a --no-link
+nix build -f multiple-outputs.nix --json e^a_a --no-link | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-e.drv")) and
- (.outputs | keys == ["a"]))
+ (.outputs | keys == ["a_a"]))
'
nix build -f multiple-outputs.nix --json 'e^*' --no-link | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-e.drv")) and
- (.outputs | keys == ["a", "b", "c"]))
+ (.outputs | keys == ["a_a", "b", "c"]))
'
# Test building from raw store path to drv not expression.
@@ -88,7 +89,7 @@ nix build "$drv^first,second" --no-link --json | jq --exit-status '
(.outputs |
(keys | length == 2) and
(.first | match(".*multiple-outputs-a-first")) and
- (.second | match(".*multiple-outputs-a-second"))))
+ (.second | match(".*multiple-outputs-a-second"))))
'
nix build "$drv^*" --no-link --json | jq --exit-status '
@@ -97,14 +98,14 @@ nix build "$drv^*" --no-link --json | jq --exit-status '
(.outputs |
(keys | length == 2) and
(.first | match(".*multiple-outputs-a-first")) and
- (.second | match(".*multiple-outputs-a-second"))))
+ (.second | match(".*multiple-outputs-a-second"))))
'
# Make sure that `--impure` works (regression test for https://github.com/NixOS/nix/issues/6488)
nix build --impure -f multiple-outputs.nix --json e --no-link | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-e.drv")) and
- (.outputs | keys == ["a", "b"]))
+ (.outputs | keys == ["a_a", "b"]))
'
testNormalization () {
diff --git a/tests/multiple-outputs.nix b/tests/multiple-outputs.nix
index 1429bc648..413d392e4 100644
--- a/tests/multiple-outputs.nix
+++ b/tests/multiple-outputs.nix
@@ -91,9 +91,9 @@ rec {
e = mkDerivation {
name = "multiple-outputs-e";
- outputs = [ "a" "b" "c" ];
- meta.outputsToInstall = [ "a" "b" ];
- buildCommand = "mkdir $a $b $c";
+ outputs = [ "a_a" "b" "c" ];
+ meta.outputsToInstall = [ "a_a" "b" ];
+ buildCommand = "mkdir $a_a $b $c";
};
independent = mkDerivation {
@@ -117,4 +117,14 @@ rec {
'';
};
+ invalid-output-name-1 = mkDerivation {
+ name = "invalid-output-name-1";
+ outputs = [ "out/"];
+ };
+
+ invalid-output-name-2 = mkDerivation {
+ name = "invalid-output-name-2";
+ outputs = [ "x" "foo$"];
+ };
+
}
diff --git a/tests/multiple-outputs.sh b/tests/multiple-outputs.sh
index 0d45ad35b..66be6fa64 100644
--- a/tests/multiple-outputs.sh
+++ b/tests/multiple-outputs.sh
@@ -83,3 +83,6 @@ nix-store --gc --keep-derivations --keep-outputs
nix-store --gc --print-roots
rm -rf $NIX_STORE_DIR/.links
rmdir $NIX_STORE_DIR
+
+nix build -f multiple-outputs.nix invalid-output-name-1 2>&1 | grep 'contains illegal character'
+nix build -f multiple-outputs.nix invalid-output-name-2 2>&1 | grep 'contains illegal character'