aboutsummaryrefslogtreecommitdiff
path: root/tests/build-dry.sh
diff options
context:
space:
mode:
authorThéophane Hufschmitt <theophane@hufschmitt.net>2022-03-17 11:34:31 +0100
committerThéophane Hufschmitt <theophane@hufschmitt.net>2022-03-17 11:55:19 +0100
commit3fc4c612fbde332d66b78dcc5b17b7d0d5235484 (patch)
treeb8de5af62186ad944edd91a183354b0984f84087 /tests/build-dry.sh
parentfe1ad9613561ea78b6d97cf82c03d2dd77e43f69 (diff)
Fix `nix build --dry-run` with CA derivations
Don’t try and assume that we know the output paths when we’ve just built with `--dry-run`. Instead make `--dry-run` follow a different code path that won’t assume the knowledge of the output paths at all. Fix #6275
Diffstat (limited to 'tests/build-dry.sh')
-rw-r--r--tests/build-dry.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/build-dry.sh b/tests/build-dry.sh
index e72533e70..f0f38e9a0 100644
--- a/tests/build-dry.sh
+++ b/tests/build-dry.sh
@@ -50,3 +50,22 @@ nix build -f dependencies.nix -o $RESULT --dry-run
nix build -f dependencies.nix -o $RESULT
[[ -h $RESULT ]]
+
+###################################################
+# Check the JSON output
+clearStore
+clearCache
+
+RES=$(nix build -f dependencies.nix --dry-run --json)
+
+if [[ -z "$NIX_TESTS_CA_BY_DEFAULT" ]]; then
+ echo "$RES" | jq '.[0] | [
+ (.drvPath | test("'$NIX_STORE_DIR'.*\\.drv")),
+ (.outputs.out | test("'$NIX_STORE_DIR'"))
+ ] | all'
+else
+ echo "$RES" | jq '.[0] | [
+ (.drvPath | test("'$NIX_STORE_DIR'.*\\.drv")),
+ .outputs.out == null
+ ] | all'
+fi