mirror of
https://github.com/NixOS/nix
synced 2025-07-10 04:43:53 +02:00
Merge remote-tracking branch 'origin/master' into lazy-trees
This commit is contained in:
commit
8becbb063a
15 changed files with 213 additions and 105 deletions
|
@ -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.
|
||||
|
@ -56,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] |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue