mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
tests/common.sh.in: Add enableFeatures helper
This commit is contained in:
parent
5d208cbe41
commit
d2586188fe
12 changed files with 13 additions and 22 deletions
|
@ -2,7 +2,7 @@ source common.sh
|
|||
|
||||
file=build-hook-ca-floating.nix
|
||||
|
||||
sed -i 's/experimental-features .*/& ca-derivations/' "$NIX_CONF_DIR"/nix.conf
|
||||
enableFeatures "ca-derivations ca-references"
|
||||
|
||||
CONTENT_ADDRESSED=true
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ testCutoffFor () {
|
|||
}
|
||||
|
||||
testCutoff () {
|
||||
# Don't directly build depenentCA, that way we'll make sure we dodn't rely on
|
||||
# Don't directly build dependentCA, that way we'll make sure we don't rely on
|
||||
# dependent derivations always being already built.
|
||||
#testDerivation dependentCA
|
||||
testCutoffFor transitivelyDependentCA
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
source ../common.sh
|
||||
|
||||
sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_DIR"/nix.conf
|
||||
enableFeatures "ca-derivations ca-references"
|
||||
|
||||
restartDaemon
|
||||
|
|
|
@ -2,8 +2,6 @@ source ./common.sh
|
|||
|
||||
requireDaemonNewerThan "2.4pre20210625"
|
||||
|
||||
sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_DIR"/nix.conf
|
||||
|
||||
export REMOTE_STORE_DIR="$TEST_ROOT/remote_store"
|
||||
export REMOTE_STORE="file://$REMOTE_STORE_DIR"
|
||||
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
source common.sh
|
||||
|
||||
# Globally enable the ca derivations experimental flag
|
||||
sed -i 's/experimental-features = .*/& ca-derivations ca-references/' "$NIX_CONF_DIR/nix.conf"
|
||||
|
||||
export REMOTE_STORE_DIR="$TEST_ROOT/remote_store"
|
||||
export REMOTE_STORE="file://$REMOTE_STORE_DIR"
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
source common.sh
|
||||
|
||||
sed -i 's/experimental-features .*/& ca-derivations ca-references nix-command flakes/' "$NIX_CONF_DIR"/nix.conf
|
||||
|
||||
FLAKE_PATH=path:$PWD
|
||||
|
||||
nix run --no-write-lock-file $FLAKE_PATH#runnable
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
source common.sh
|
||||
|
||||
sed -i 's/experimental-features .*/& ca-derivations ca-references nix-command flakes/' "$NIX_CONF_DIR"/nix.conf
|
||||
|
||||
CONTENT_ADDRESSED=true
|
||||
cd ..
|
||||
source ./nix-shell.sh
|
||||
|
|
|
@ -4,8 +4,6 @@ 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 ./post-hook.sh
|
||||
|
|
|
@ -4,8 +4,6 @@ source common.sh
|
|||
|
||||
requireDaemonNewerThan "2.4pre20210623"
|
||||
|
||||
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 ./recursive.sh
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
source common.sh
|
||||
|
||||
# Globally enable the ca derivations experimental flag
|
||||
sed -i 's/experimental-features = .*/& ca-derivations ca-references/' "$NIX_CONF_DIR/nix.conf"
|
||||
|
||||
clearStore
|
||||
clearCache
|
||||
|
||||
|
|
|
@ -173,10 +173,15 @@ needLocalStore() {
|
|||
}
|
||||
|
||||
# Just to make it easy to find which tests should be fixed
|
||||
buggyNeedLocalStore () {
|
||||
buggyNeedLocalStore() {
|
||||
needLocalStore
|
||||
}
|
||||
|
||||
enableFeatures() {
|
||||
local features="$1"
|
||||
sed -i 's/experimental-features .*/& '"$features"'/' "$NIX_CONF_DIR"/nix.conf
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
|
||||
|
|
|
@ -3,6 +3,8 @@ source common.sh
|
|||
clearStore
|
||||
clearProfiles
|
||||
|
||||
enableFeatures "ca-derivations ca-references"
|
||||
|
||||
# Make a flake.
|
||||
flake1Dir=$TEST_ROOT/flake1
|
||||
mkdir -p $flake1Dir
|
||||
|
@ -82,13 +84,13 @@ nix profile wipe-history
|
|||
# Test upgrade to CA package.
|
||||
printf true > $flake1Dir/ca.nix
|
||||
printf 3.0 > $flake1Dir/version
|
||||
nix profile upgrade --extra-experimental-features ca-derivations 0
|
||||
nix profile upgrade 0
|
||||
nix profile history | grep "packages.$system.default: 1.0 -> 3.0"
|
||||
|
||||
# Test new install of CA package.
|
||||
nix profile remove 0
|
||||
printf 4.0 > $flake1Dir/version
|
||||
printf Utrecht > $flake1Dir/who
|
||||
nix profile install --extra-experimental-features ca-derivations $flake1Dir
|
||||
nix profile install $flake1Dir
|
||||
[[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello Utrecht" ]]
|
||||
[[ $(nix path-info --json $(realpath $TEST_HOME/.nix-profile/bin/hello) | jq -r .[].ca) =~ fixed:r:sha256: ]]
|
||||
|
|
Loading…
Reference in a new issue