2021-02-12 21:51:36 +00:00
|
|
|
source common.sh
|
|
|
|
|
2022-07-15 00:22:46 +00:00
|
|
|
set -o pipefail
|
|
|
|
|
2021-02-12 21:51:36 +00:00
|
|
|
drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)
|
2022-07-15 00:22:46 +00:00
|
|
|
if nix build "$drv^not-an-output" --no-link --json; then
|
2021-02-12 21:51:36 +00:00
|
|
|
fail "'not-an-output' should fail to build"
|
|
|
|
fi
|
|
|
|
|
2022-07-15 00:22:46 +00:00
|
|
|
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 '
|
2021-02-12 21:51:36 +00:00
|
|
|
(.[0] |
|
|
|
|
(.drvPath | match(".*multiple-outputs-a.drv")) and
|
|
|
|
(.outputs |
|
2022-03-25 16:46:28 +00:00
|
|
|
(keys | length == 1) and
|
2022-03-10 17:03:16 +00:00
|
|
|
(.first | match(".*multiple-outputs-a-first")) and
|
|
|
|
(has("second") | not)))
|
2021-02-12 21:51:36 +00:00
|
|
|
'
|
2022-07-15 00:22:46 +00:00
|
|
|
|
|
|
|
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"))))
|
|
|
|
'
|