aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 07:15:08 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 07:15:08 +0100
commit13f78c557b402422aefc09cc217b001d83f08baa (patch)
tree09cd9c8708df37bbc9bdfddcc26f20d82320e4b3 /tests
parentbc34274aae277bb5b05d3e833fbdc0bd30c7250a (diff)
Merge pull request #9589 from obsidiansystems/floating-content-addressing-derivations-eval-store
Fix building CA derivations with and eval store (cherry picked from commit dfc0cee7024a082d90a4f68296f55a82dfd52126) Change-Id: I28feb5a36d4fe75f0ed3e3e2db6eb56b67d0f371
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/ca/eval-store.sh10
-rw-r--r--tests/functional/ca/local.mk1
-rw-r--r--tests/functional/eval-store.sh16
3 files changed, 25 insertions, 2 deletions
diff --git a/tests/functional/ca/eval-store.sh b/tests/functional/ca/eval-store.sh
new file mode 100644
index 000000000..9cc499606
--- /dev/null
+++ b/tests/functional/ca/eval-store.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+# Ensure that garbage collection works properly with ca derivations
+
+source common.sh
+
+export NIX_TESTS_CA_BY_DEFAULT=1
+
+cd ..
+source eval-store.sh
diff --git a/tests/functional/ca/local.mk b/tests/functional/ca/local.mk
index fd87b8d1f..4f86b268f 100644
--- a/tests/functional/ca/local.mk
+++ b/tests/functional/ca/local.mk
@@ -5,6 +5,7 @@ ca-tests := \
$(d)/concurrent-builds.sh \
$(d)/derivation-json.sh \
$(d)/duplicate-realisation-in-closure.sh \
+ $(d)/eval-store.sh \
$(d)/gc.sh \
$(d)/import-derivation.sh \
$(d)/new-build-cmd.sh \
diff --git a/tests/functional/eval-store.sh b/tests/functional/eval-store.sh
index a34f3e82f..9937ecbce 100644
--- a/tests/functional/eval-store.sh
+++ b/tests/functional/eval-store.sh
@@ -11,7 +11,16 @@ rm -rf "$eval_store"
nix build -f dependencies.nix --eval-store "$eval_store" -o "$TEST_ROOT/result"
[[ -e $TEST_ROOT/result/foobar ]]
-(! ls $NIX_STORE_DIR/*.drv)
+if [[ ! -n "${NIX_TESTS_CA_BY_DEFAULT:-}" ]]; then
+ # Resolved CA derivations are written to store for building
+ #
+ # TODO when we something more systematic
+ # (https://github.com/NixOS/nix/issues/5025) that distinguishes
+ # between scratch storage for building and the final destination
+ # store, we'll be able to make this unconditional again -- resolved
+ # derivations should only appear in the scratch store.
+ (! ls $NIX_STORE_DIR/*.drv)
+fi
ls $eval_store/nix/store/*.drv
clearStore
@@ -26,7 +35,10 @@ rm -rf "$eval_store"
nix-build dependencies.nix --eval-store "$eval_store" -o "$TEST_ROOT/result"
[[ -e $TEST_ROOT/result/foobar ]]
-(! ls $NIX_STORE_DIR/*.drv)
+if [[ ! -n "${NIX_TESTS_CA_BY_DEFAULT:-}" ]]; then
+ # See above
+ (! ls $NIX_STORE_DIR/*.drv)
+fi
ls $eval_store/nix/store/*.drv
clearStore