From a3ce88725b44a30184cbe8706fc3a53a8610cc47 Mon Sep 17 00:00:00 2001 From: regnat Date: Tue, 15 Jun 2021 12:11:31 +0200 Subject: [PATCH] Add a test for the gc with CA derivations Also add a small architecture to easily run CA-enabled tests --- tests/ca/gc.sh | 12 ++++++++++++ tests/config.nix.in | 11 ++++++++++- tests/local.mk | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 tests/ca/gc.sh 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 59eb4eb0f..e40178b80 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 \