diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/build-explicit-output.sh | 15 | ||||
-rw-r--r-- | tests/build.sh | 12 | ||||
-rw-r--r-- | tests/local.mk | 1 |
3 files changed, 23 insertions, 5 deletions
diff --git a/tests/build-explicit-output.sh b/tests/build-explicit-output.sh new file mode 100644 index 000000000..fcb263913 --- /dev/null +++ b/tests/build-explicit-output.sh @@ -0,0 +1,15 @@ +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 | + (keys | length == 1) and + (.first | match(".*multiple-outputs-a-first")) and + (has("second") | not))) +' diff --git a/tests/build.sh b/tests/build.sh index 13a0f42be..5757ca73f 100644 --- a/tests/build.sh +++ b/tests/build.sh @@ -13,13 +13,15 @@ nix build -f multiple-outputs.nix --json a --no-link | jq --exit-status ' nix build -f multiple-outputs.nix --json a.all b.all --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")))) ' testNormalization () { diff --git a/tests/local.mk b/tests/local.mk index 97971dd76..592cad68b 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -89,6 +89,7 @@ nix_tests = \ ssh-relay.sh \ plugins.sh \ build.sh \ + build-explicit-output.sh \ ca/nix-run.sh \ db-migration.sh \ bash-profile.sh \ |