aboutsummaryrefslogtreecommitdiff
path: root/tests/dependencies.sh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2023-09-19 13:33:56 +0200
committerEelco Dolstra <edolstra@gmail.com>2023-09-19 13:33:56 +0200
commitc451b48993daa6dd3992805eaf6119c1ffd1d0c3 (patch)
tree7ae3919a52b5f008c9ee00a5f7464049177df9d2 /tests/dependencies.sh
parent539cc5e5f00c0d524dec6e73b08ab8cb0f5a9630 (diff)
parent2a52ec4e928c254338a612a6b40355512298ef38 (diff)
Merge remote-tracking branch 'origin/master' into p/flake-update
Diffstat (limited to 'tests/dependencies.sh')
-rw-r--r--tests/dependencies.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/dependencies.sh b/tests/dependencies.sh
index d5cd30396..b93dacac0 100644
--- a/tests/dependencies.sh
+++ b/tests/dependencies.sh
@@ -53,3 +53,20 @@ nix-store -q --referrers-closure "$input2OutPath" | grep "$outPath"
# Check that the derivers are set properly.
test $(nix-store -q --deriver "$outPath") = "$drvPath"
nix-store -q --deriver "$input2OutPath" | grepQuiet -- "-input-2.drv"
+
+# --valid-derivers returns the currently single valid .drv file
+test "$(nix-store -q --valid-derivers "$outPath")" = "$drvPath"
+
+# instantiate a different drv with the same output
+drvPath2=$(nix-instantiate dependencies.nix --argstr hashInvalidator yay)
+
+# now --valid-derivers returns both
+test "$(nix-store -q --valid-derivers "$outPath" | sort)" = "$(sort <<< "$drvPath"$'\n'"$drvPath2")"
+
+# check that nix-store --valid-derivers only returns existing drv
+nix-store --delete "$drvPath"
+test "$(nix-store -q --valid-derivers "$outPath")" = "$drvPath2"
+
+# check that --valid-derivers returns nothing when there are no valid derivers
+nix-store --delete "$drvPath2"
+test -z "$(nix-store -q --valid-derivers "$outPath")"