aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ca/selfref-gc.sh11
-rw-r--r--tests/local.mk1
-rw-r--r--tests/selfref-gc.sh28
3 files changed, 40 insertions, 0 deletions
diff --git a/tests/ca/selfref-gc.sh b/tests/ca/selfref-gc.sh
new file mode 100755
index 000000000..89657f6de
--- /dev/null
+++ b/tests/ca/selfref-gc.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+source common.sh
+
+requireDaemonNewerThan "2.4pre20210626"
+
+sed -i 's/experimental-features .*/& ca-derivations ca-references nix-command flakes/' "$NIX_CONF_DIR"/nix.conf
+
+export NIX_TESTS_CA_BY_DEFAULT=1
+cd ..
+source ./selfref-gc.sh
diff --git a/tests/local.mk b/tests/local.mk
index cb869f32e..e3c4ff4eb 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -92,6 +92,7 @@ nix_tests = \
plugins.sh \
build.sh \
ca/nix-run.sh \
+ selfref-gc.sh ca/selfref-gc.sh \
db-migration.sh \
bash-profile.sh \
pass-as-file.sh \
diff --git a/tests/selfref-gc.sh b/tests/selfref-gc.sh
new file mode 100644
index 000000000..cf1c4d18e
--- /dev/null
+++ b/tests/selfref-gc.sh
@@ -0,0 +1,28 @@
+source common.sh
+
+clearStore
+
+nix-build --no-out-link -E '
+ with import ./config.nix;
+
+ let d1 = mkDerivation {
+ name = "selfref-gc";
+ outputs = [ "out" ];
+ buildCommand = "
+ echo SELF_REF: $out > $out
+ ";
+ }; in
+
+ # the only change from d1 is d1 as an (unused) build input
+ # to get identical store path in CA.
+ mkDerivation {
+ name = "selfref-gc";
+ outputs = [ "out" ];
+ buildCommand = "
+ echo UNUSED: ${d1}
+ echo SELF_REF: $out > $out
+ ";
+ }
+'
+
+nix-collect-garbage