aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-12-12 17:34:57 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-12-12 17:34:57 -0500
commitc886b1856184fc180603435197a10ea20df8bcfb (patch)
treef786f9e7bb505fabdf2af2a107e977c9350672b2
parentd8c1c24c78ebeb1f695e29a489be567118eb073e (diff)
Merge new tests into `build.sh`
-rw-r--r--tests/build-explicit-output.sh43
-rw-r--r--tests/build.sh42
-rw-r--r--tests/local.mk1
3 files changed, 42 insertions, 44 deletions
diff --git a/tests/build-explicit-output.sh b/tests/build-explicit-output.sh
deleted file mode 100644
index 45320d6e3..000000000
--- a/tests/build-explicit-output.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-source common.sh
-
-set -o pipefail
-
-drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)
-if nix build "$drv^not-an-output" --no-link --json; then
- fail "'not-an-output' should fail to build"
-fi
-
-if nix build "$drv^" --no-link --json; then
- fail "'empty outputs list' should fail to build"
-fi
-
-if nix build "$drv^*nope" --no-link --json; then
- fail "'* must be entire string' should fail to build"
-fi
-
-nix build "$drv^first" --no-link --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)))
-'
-
-nix build "$drv^first,second" --no-link --json | jq --exit-status '
- (.[0] |
- (.drvPath | match(".*multiple-outputs-a.drv")) and
- (.outputs |
- (keys | length == 2) and
- (.first | match(".*multiple-outputs-a-first")) and
- (.second | match(".*multiple-outputs-a-second"))))
-'
-
-nix build "$drv^*" --no-link --json | jq --exit-status '
- (.[0] |
- (.drvPath | match(".*multiple-outputs-a.drv")) and
- (.outputs |
- (keys | length == 2) and
- (.first | match(".*multiple-outputs-a-first")) and
- (.second | match(".*multiple-outputs-a-second"))))
-'
diff --git a/tests/build.sh b/tests/build.sh
index 3a3d773b1..036fb037e 100644
--- a/tests/build.sh
+++ b/tests/build.sh
@@ -58,6 +58,48 @@ nix build -f multiple-outputs.nix --json 'e^*' --no-link | jq --exit-status '
(.outputs | keys == ["a", "b", "c"]))
'
+# Test building from raw store path to drv not expression.
+
+drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)
+if nix build "$drv^not-an-output" --no-link --json; then
+ fail "'not-an-output' should fail to build"
+fi
+
+if nix build "$drv^" --no-link --json; then
+ fail "'empty outputs list' should fail to build"
+fi
+
+if nix build "$drv^*nope" --no-link --json; then
+ fail "'* must be entire string' should fail to build"
+fi
+
+nix build "$drv^first" --no-link --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)))
+'
+
+nix build "$drv^first,second" --no-link --json | jq --exit-status '
+ (.[0] |
+ (.drvPath | match(".*multiple-outputs-a.drv")) and
+ (.outputs |
+ (keys | length == 2) and
+ (.first | match(".*multiple-outputs-a-first")) and
+ (.second | match(".*multiple-outputs-a-second"))))
+'
+
+nix build "$drv^*" --no-link --json | jq --exit-status '
+ (.[0] |
+ (.drvPath | match(".*multiple-outputs-a.drv")) and
+ (.outputs |
+ (keys | length == 2) and
+ (.first | match(".*multiple-outputs-a-first")) and
+ (.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] |
diff --git a/tests/local.mk b/tests/local.mk
index aff595d3b..340817ec3 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -98,7 +98,6 @@ 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 \