aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/build-explicit-output.sh17
-rw-r--r--tests/build.sh5
-rw-r--r--tests/local.mk1
3 files changed, 21 insertions, 2 deletions
diff --git a/tests/build-explicit-output.sh b/tests/build-explicit-output.sh
new file mode 100644
index 000000000..17930c2c0
--- /dev/null
+++ b/tests/build-explicit-output.sh
@@ -0,0 +1,17 @@
+source common.sh
+
+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 |
+ .first and
+ (has("second") | not)))
+'
+# TODO use
+# (.first | match(".*multiple-outputs-a-first")) and
+# once we make it put the result paths in the buildables.
diff --git a/tests/build.sh b/tests/build.sh
index aa54b88eb..5a2819336 100644
--- a/tests/build.sh
+++ b/tests/build.sh
@@ -4,8 +4,9 @@ expectedJSONRegex='\[\{"drvPath":".*multiple-outputs-a.drv","outputs":\{"first":
nix build -f multiple-outputs.nix --json a.all b.all | jq --exit-status '
(.[0] |
(.drvPath | match(".*multiple-outputs-a.drv")) and
- (.outputs.first | match(".*multiple-outputs-a-first")) and
- (.outputs.second | match(".*multiple-outputs-a-second")))
+ (.outputs |
+ (.first | match(".*multiple-outputs-a-first")) and
+ (.second | match(".*multiple-outputs-a-second"))))
and (.[1] |
(.drvPath | match(".*multiple-outputs-b.drv")) and
(.outputs.out | match(".*multiple-outputs-b")))
diff --git a/tests/local.mk b/tests/local.mk
index e7e85f97e..1d3e89499 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -41,6 +41,7 @@ nix_tests = \
describe-stores.sh \
flakes.sh \
build.sh \
+ build-explicit-output.sh \
compute-levels.sh \
ca/build.sh \
ca/substitute.sh \