aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/build-explicit-output.sh18
-rw-r--r--tests/build.sh12
-rw-r--r--tests/local.mk1
3 files changed, 26 insertions, 5 deletions
diff --git a/tests/build-explicit-output.sh b/tests/build-explicit-output.sh
new file mode 100644
index 000000000..68fd2f128
--- /dev/null
+++ b/tests/build-explicit-output.sh
@@ -0,0 +1,18 @@
+source common.sh
+
+enableFeatures "computed-derivations"
+restartDaemon
+
+drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)
+if nix build "$drv^not-an-output" --json; then
+ fail "'not-an-output' should fail to build"
+fi
+
+nix build "$drv^first" --json | jq --exit-status '
+ (.[0] |
+ (.drvPath | match(".*multiple-outputs-a.drv")) and
+ (.outputs |
+ (keys | length == 1) and
+ (.first | match(".*multiple-outputs-a-first")) and
+ (has("second") | not)))
+'
diff --git a/tests/build.sh b/tests/build.sh
index fc6825e25..b3c572016 100644
--- a/tests/build.sh
+++ b/tests/build.sh
@@ -8,13 +8,15 @@ set -o pipefail
nix build -f multiple-outputs.nix --json a b --no-link | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-a.drv")) and
- (.outputs | keys | length == 2) and
- (.outputs.first | match(".*multiple-outputs-a-first")) and
- (.outputs.second | match(".*multiple-outputs-a-second")))
+ (.outputs |
+ (keys | length == 2) and
+ (.first | match(".*multiple-outputs-a-first")) and
+ (.second | match(".*multiple-outputs-a-second"))))
and (.[1] |
(.drvPath | match(".*multiple-outputs-b.drv")) and
- (.outputs | keys | length == 1) and
- (.outputs.out | match(".*multiple-outputs-b")))
+ (.outputs |
+ (keys | length == 1) and
+ (.out | match(".*multiple-outputs-b"))))
'
# Test output selection using the '^' syntax.
diff --git a/tests/local.mk b/tests/local.mk
index dd4924f00..9734df08b 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -98,6 +98,7 @@ nix_tests = \
ssh-relay.sh \
plugins.sh \
build.sh \
+ build-explicit-output.sh \
ca/nix-run.sh \
selfref-gc.sh ca/selfref-gc.sh \
db-migration.sh \