diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-07-14 20:22:46 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-07-14 20:23:43 -0400 |
commit | 8735f55decab03ecf3571f756a22abc3b3dc6304 (patch) | |
tree | 38742c11469a47e1bcb6884d917eb4f250b74a84 /tests | |
parent | f3262bc2165af90fd20f04f74243aa75137767a2 (diff) |
Fix bug, test more, document more
Diffstat (limited to 'tests')
-rw-r--r-- | tests/build-explicit-output.sh | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/build-explicit-output.sh b/tests/build-explicit-output.sh index 68fd2f128..a4cb1c5ad 100644 --- a/tests/build-explicit-output.sh +++ b/tests/build-explicit-output.sh @@ -1,14 +1,24 @@ source common.sh +set -o pipefail + enableFeatures "computed-derivations" restartDaemon drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath) -if nix build "$drv^not-an-output" --json; then +if nix build "$drv^not-an-output" --no-link --json; then fail "'not-an-output' should fail to build" fi -nix build "$drv^first" --json | jq --exit-status ' +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 | @@ -16,3 +26,21 @@ nix build "$drv^first" --json | jq --exit-status ' (.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")))) +' |