aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-06-23 10:07:08 +0200
committerGitHub <noreply@github.com>2021-06-23 10:07:08 +0200
commit26d2c62225b3c8a33dbee3cf83f8d2acd1675aa8 (patch)
treef5321ed02f695b8e43f3891762bfa32f0085f6cf /tests
parentd9a43d3137ad2b4d1bce546a21164dbad3eb764c (diff)
parenta3ce88725b44a30184cbe8706fc3a53a8610cc47 (diff)
Merge pull request #4906 from NixOS/collect-garbage-ca
Make `computeFSClosure` ca-aware
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ca/gc.sh12
-rw-r--r--tests/config.nix.in11
-rw-r--r--tests/local.mk1
3 files changed, 23 insertions, 1 deletions
diff --git a/tests/ca/gc.sh b/tests/ca/gc.sh
new file mode 100755
index 000000000..e4f9857d6
--- /dev/null
+++ b/tests/ca/gc.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+# Ensure that garbage collection works properly with ca derivations
+
+source common.sh
+
+sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_DIR"/nix.conf
+
+export NIX_TESTS_CA_BY_DEFAULT=1
+
+cd ..
+source gc.sh
diff --git a/tests/config.nix.in b/tests/config.nix.in
index a57a8c596..9b00d9ddb 100644
--- a/tests/config.nix.in
+++ b/tests/config.nix.in
@@ -1,3 +1,12 @@
+let
+ contentAddressedByDefault = builtins.getEnv "NIX_TESTS_CA_BY_DEFAULT" == "1";
+ caArgs = if contentAddressedByDefault then {
+ __contentAddressed = true;
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ } else {};
+in
+
rec {
shell = "@bash@";
@@ -15,4 +24,4 @@ rec {
PATH = path;
} // removeAttrs args ["builder" "meta"])
// { meta = args.meta or {}; };
-}
+} // caArgs
diff --git a/tests/local.mk b/tests/local.mk
index 663b8c8bc..0d594cda0 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -2,6 +2,7 @@ nix_tests = \
hash.sh lang.sh add.sh simple.sh dependencies.sh \
config.sh \
gc.sh \
+ ca/gc.sh \
gc-concurrent.sh \
gc-auto.sh \
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \