mirror of
https://github.com/NixOS/nix
synced 2025-07-13 17:10:47 +02:00
Tagging release 2.26.2
-----BEGIN PGP SIGNATURE----- iQFHBAABCAAxFiEEtUHVUwEnDgvPFcpdgXC0cm1xmN4FAmetA5oTHGVkb2xzdHJh QGdtYWlsLmNvbQAKCRCBcLRybXGY3g2pB/9JAFyjmaXuccbMTO/6x9qwsWuuXNLk OQWzfbdUekvsihZZSFZg1r7KqqXHCi64f0nxLPsJ/0oeDWZktJ5KnbV630nuUlDj ulLCpKdvhWFa8dVx9LiziGwQw4KLx8PjOfwThtQ4DqCWxWEmu6lKkijag9cE+ai4 3mw9YtUjBRxlXyhYLzWz3whLbv37c/m+R8iGS8xm8W260pmei6D0beOIPdfXYBQF PzPlPORyI08A06uqyA3z7bTxzmSMnzvu0QInCPCKSHzFUnTZPHUYuYStFl28NrZS fXKK59L0G7QEfdTRAmqQkdHdtPj2RlYFiMN0kQiNLflvKfGGWdi/kvdx =rRix -----END PGP SIGNATURE----- Merge tag '2.26.2' into sync-2.26.2 Tagging release 2.26.2
This commit is contained in:
commit
4055239936
1395 changed files with 24694 additions and 16040 deletions
|
@ -1,10 +1,10 @@
|
|||
# NOTE: instances of @variable@ are substituted as defined in /mk/templates.mk
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
if [[ -z "${COMMON_VARS_AND_FUNCTIONS_SH_SOURCED-}" ]]; then
|
||||
if [[ -z "${COMMON_FUNCTIONS_SH_SOURCED-}" ]]; then
|
||||
|
||||
COMMON_VARS_AND_FUNCTIONS_SH_SOURCED=1
|
||||
COMMON_FUNCTIONS_SH_SOURCED=1
|
||||
|
||||
isTestOnNixOS() {
|
||||
[[ "${isTestOnNixOS:-}" == 1 ]]
|
||||
|
@ -15,70 +15,20 @@ die() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
set +x
|
||||
|
||||
commonDir="$(readlink -f "$(dirname "${BASH_SOURCE[0]-$0}")")"
|
||||
|
||||
source "$commonDir/subst-vars.sh"
|
||||
# Make sure shellcheck knows all these will be defined by the above generated snippet
|
||||
: "${bindir?} ${coreutils?} ${dot?} ${SHELL?} ${PAGER?} ${busybox?} ${version?} ${system?} ${BUILD_SHARED_LIBS?}"
|
||||
|
||||
source "$commonDir/paths.sh"
|
||||
source "$commonDir/test-root.sh"
|
||||
|
||||
test_nix_conf_dir=$TEST_ROOT/etc
|
||||
test_nix_conf=$test_nix_conf_dir/nix.conf
|
||||
|
||||
export TEST_HOME=$TEST_ROOT/test-home
|
||||
|
||||
if ! isTestOnNixOS; then
|
||||
export NIX_STORE_DIR
|
||||
if ! NIX_STORE_DIR=$(readlink -f $TEST_ROOT/store 2> /dev/null); then
|
||||
# Maybe the build directory is symlinked.
|
||||
export NIX_IGNORE_SYMLINK_STORE=1
|
||||
NIX_STORE_DIR=$TEST_ROOT/store
|
||||
fi
|
||||
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
|
||||
export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||
export NIX_CONF_DIR=$test_nix_conf_dir
|
||||
export NIX_DAEMON_SOCKET_PATH=$TEST_ROOT/dSocket
|
||||
unset NIX_USER_CONF_FILES
|
||||
export _NIX_TEST_SHARED=$TEST_ROOT/shared
|
||||
if [[ -n $NIX_STORE ]]; then
|
||||
export _NIX_TEST_NO_SANDBOX=1
|
||||
fi
|
||||
export _NIX_IN_TEST=$TEST_ROOT/shared
|
||||
export _NIX_TEST_NO_LSOF=1
|
||||
export NIX_REMOTE=${NIX_REMOTE_-}
|
||||
|
||||
fi # ! isTestOnNixOS
|
||||
|
||||
unset NIX_PATH
|
||||
export HOME=$TEST_HOME
|
||||
unset XDG_STATE_HOME
|
||||
unset XDG_DATA_HOME
|
||||
unset XDG_CONFIG_HOME
|
||||
unset XDG_CONFIG_DIRS
|
||||
unset XDG_CACHE_HOME
|
||||
|
||||
export IMPURE_VAR1=foo
|
||||
export IMPURE_VAR2=bar
|
||||
|
||||
cacheDir=$TEST_ROOT/binary-cache
|
||||
|
||||
readLink() {
|
||||
# TODO fix this
|
||||
# shellcheck disable=SC2012
|
||||
ls -l "$1" | sed 's/.*->\ //'
|
||||
}
|
||||
|
||||
clearProfiles() {
|
||||
profiles="$HOME"/.local/state/nix/profiles
|
||||
profiles="$HOME/.local/state/nix/profiles"
|
||||
rm -rf "$profiles"
|
||||
}
|
||||
|
||||
# Clear the store, but do not fail if we're in an environment where we can't.
|
||||
# This allows the test to run in a NixOS test environment, where we use the system store.
|
||||
# See doc/manual/src/contributing/testing.md / Running functional tests on NixOS.
|
||||
# See doc/manual/source/contributing/testing.md / Running functional tests on NixOS.
|
||||
clearStoreIfPossible() {
|
||||
if isTestOnNixOS; then
|
||||
echo "clearStoreIfPossible: Not clearing store, because we're on NixOS. Moving on."
|
||||
|
@ -105,11 +55,11 @@ doClearStore() {
|
|||
}
|
||||
|
||||
clearCache() {
|
||||
rm -rf "$cacheDir"
|
||||
rm -rf "${cacheDir?}"
|
||||
}
|
||||
|
||||
clearCacheCache() {
|
||||
rm -f $TEST_HOME/.cache/nix/binary-cache*
|
||||
rm -f "$TEST_HOME/.cache/nix/binary-cache"*
|
||||
}
|
||||
|
||||
startDaemon() {
|
||||
|
@ -122,9 +72,9 @@ startDaemon() {
|
|||
return
|
||||
fi
|
||||
# Start the daemon, wait for the socket to appear.
|
||||
rm -f $NIX_DAEMON_SOCKET_PATH
|
||||
rm -f "$NIX_DAEMON_SOCKET_PATH"
|
||||
# TODO: remove the nix-command feature when we're no longer testing against old daemons.
|
||||
PATH=$DAEMON_PATH nix daemon --extra-experimental-features nix-command &
|
||||
PATH=$DAEMON_PATH nix --extra-experimental-features 'nix-command' daemon &
|
||||
_NIX_TEST_DAEMON_PID=$!
|
||||
export _NIX_TEST_DAEMON_PID
|
||||
for ((i = 0; i < 300; i++)); do
|
||||
|
@ -152,14 +102,14 @@ killDaemon() {
|
|||
if [[ "${_NIX_TEST_DAEMON_PID-}" == '' ]]; then
|
||||
return
|
||||
fi
|
||||
kill $_NIX_TEST_DAEMON_PID
|
||||
kill "$_NIX_TEST_DAEMON_PID"
|
||||
for i in {0..100}; do
|
||||
kill -0 $_NIX_TEST_DAEMON_PID 2> /dev/null || break
|
||||
kill -0 "$_NIX_TEST_DAEMON_PID" 2> /dev/null || break
|
||||
sleep 0.1
|
||||
done
|
||||
kill -9 $_NIX_TEST_DAEMON_PID 2> /dev/null || true
|
||||
wait $_NIX_TEST_DAEMON_PID || true
|
||||
rm -f $NIX_DAEMON_SOCKET_PATH
|
||||
kill -9 "$_NIX_TEST_DAEMON_PID" 2> /dev/null || true
|
||||
wait "$_NIX_TEST_DAEMON_PID" || true
|
||||
rm -f "$NIX_DAEMON_SOCKET_PATH"
|
||||
# Indicate daemon is stopped
|
||||
unset _NIX_TEST_DAEMON_PID
|
||||
# Restore old nix remote
|
||||
|
@ -178,14 +128,11 @@ restartDaemon() {
|
|||
startDaemon
|
||||
}
|
||||
|
||||
if [[ $(uname) == Linux ]] && [[ -L /proc/self/ns/user ]] && unshare --user true; then
|
||||
_canUseSandbox=1
|
||||
fi
|
||||
|
||||
isDaemonNewer () {
|
||||
[[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0
|
||||
local requiredVersion="$1"
|
||||
local daemonVersion=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version | sed 's/.*) //')
|
||||
local daemonVersion
|
||||
daemonVersion=$("$NIX_DAEMON_PACKAGE/bin/nix" daemon --version | sed 's/.*) //')
|
||||
[[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]]
|
||||
}
|
||||
|
||||
|
@ -238,7 +185,7 @@ expect() {
|
|||
shift
|
||||
"$@" && res=0 || res="$?"
|
||||
# also match "negative" codes, which wrap around to >127
|
||||
if [[ $res -ne $expected && $res -ne $[256 + expected] ]]; then
|
||||
if [[ $res -ne $expected && $res -ne $((256 + expected)) ]]; then
|
||||
echo "Expected exit code '$expected' but got '$res' from command ${*@Q}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
@ -253,7 +200,7 @@ expectStderr() {
|
|||
shift
|
||||
"$@" 2>&1 && res=0 || res="$?"
|
||||
# also match "negative" codes, which wrap around to >127
|
||||
if [[ $res -ne $expected && $res -ne $[256 + expected] ]]; then
|
||||
if [[ $res -ne $expected && $res -ne $((256 + expected)) ]]; then
|
||||
echo "Expected exit code '$expected' but got '$res' from command ${*@Q}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
@ -268,7 +215,7 @@ expectStderr() {
|
|||
# error: This error is expected
|
||||
# EOF
|
||||
assertStderr() {
|
||||
diff -u /dev/stdin <($@ 2>/dev/null 2>&1)
|
||||
diff -u /dev/stdin <("$@" 2>/dev/null 2>&1)
|
||||
}
|
||||
|
||||
needLocalStore() {
|
||||
|
@ -284,11 +231,9 @@ buggyNeedLocalStore() {
|
|||
|
||||
enableFeatures() {
|
||||
local features="$1"
|
||||
sed -i 's/experimental-features .*/& '"$features"'/' "$test_nix_conf_dir"/nix.conf
|
||||
sed -i 's/experimental-features .*/& '"$features"'/' "${test_nix_conf?}"
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
onError() {
|
||||
set +x
|
||||
echo "$0: test failed at:" >&2
|
||||
|
@ -312,15 +257,15 @@ callerPrefix() {
|
|||
local i file line fn savedFn
|
||||
# Use `caller`
|
||||
for i in $(seq 0 100); do
|
||||
caller $i > /dev/null || {
|
||||
caller "$i" > /dev/null || {
|
||||
if [[ -n "${file:-}" ]]; then
|
||||
echo "$file:$line: ${savedFn+in call to $savedFn: }"
|
||||
fi
|
||||
break
|
||||
}
|
||||
line="$(caller $i | cut -d' ' -f1)"
|
||||
fn="$(caller $i | cut -d' ' -f2)"
|
||||
file="$(caller $i | cut -d' ' -f3)"
|
||||
line="$(caller "$i" | cut -d' ' -f1)"
|
||||
fn="$(caller "$i" | cut -d' ' -f2)"
|
||||
file="$(caller "$i" | cut -d' ' -f3)"
|
||||
if [[ $file != "${BASH_SOURCE[0]}" ]]; then
|
||||
echo "$file:$line: ${savedFn+in call to $savedFn: }"
|
||||
return
|
||||
|
@ -343,7 +288,7 @@ checkGrepArgs() {
|
|||
for arg in "$@"; do
|
||||
if [[ "$arg" != "${arg//$'\n'/_}" ]]; then
|
||||
echo "$(callerPrefix)newline not allowed in arguments; grep would try each line individually as if connected by an OR operator" >&2
|
||||
return -101
|
||||
return 155 # = -101 mod 256
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -401,4 +346,15 @@ count() {
|
|||
|
||||
trap onError ERR
|
||||
|
||||
fi # COMMON_VARS_AND_FUNCTIONS_SH_SOURCED
|
||||
requiresUnprivilegedUserNamespaces() {
|
||||
if [[ -f /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]] && [[ $(< /proc/sys/kernel/apparmor_restrict_unprivileged_userns) -eq 1 ]]; then
|
||||
skipTest "Unprivileged user namespaces are disabled. Run 'sudo sysctl -w /proc/sys/kernel/apparmor_restrict_unprivileged_userns=0' to allow, and run these tests."
|
||||
fi
|
||||
}
|
||||
|
||||
execUnshare () {
|
||||
requiresUnprivilegedUserNamespaces
|
||||
exec unshare --mount --map-root-user "$SHELL" "$@"
|
||||
}
|
||||
|
||||
fi # COMMON_FUNCTIONS_SH_SOURCED
|
|
@ -7,10 +7,10 @@ if isTestOnNixOS; then
|
|||
|
||||
mkdir -p "$test_nix_conf_dir" "$TEST_HOME"
|
||||
|
||||
export NIX_USER_CONF_FILES="$test_nix_conf_dir/nix.conf"
|
||||
export NIX_USER_CONF_FILES="$test_nix_conf"
|
||||
mkdir -p "$test_nix_conf_dir" "$TEST_HOME"
|
||||
! test -e "$test_nix_conf"
|
||||
cat > "$test_nix_conf_dir/nix.conf" <<EOF
|
||||
cat > "$test_nix_conf" <<EOF
|
||||
# TODO: this is not needed for all tests and prevents stable commands from be tested in isolation
|
||||
flake-registry = $TEST_ROOT/registry.json
|
||||
show-trace = true
|
||||
|
@ -18,7 +18,7 @@ EOF
|
|||
|
||||
# When we're doing everything in the same store, we need to bring
|
||||
# dependencies into context.
|
||||
sed -i "$(dirname "${BASH_SOURCE[0]}")"/../config.nix \
|
||||
sed -i "${_NIX_TEST_BUILD_DIR}/config.nix" \
|
||||
-e 's^\(shell\) = "/nix/store/\([^/]*\)/\(.*\)";^\1 = builtins.appendContext "/nix/store/\2" { "/nix/store/\2".path = true; } + "/\3";^' \
|
||||
-e 's^\(path\) = "/nix/store/\([^/]*\)/\(.*\)";^\1 = builtins.appendContext "/nix/store/\2" { "/nix/store/\2".path = true; } + "/\3";^' \
|
||||
;
|
||||
|
|
5
tests/functional/common/meson.build
Normal file
5
tests/functional/common/meson.build
Normal file
|
@ -0,0 +1,5 @@
|
|||
configure_file(
|
||||
input : 'subst-vars.sh.in',
|
||||
output : 'subst-vars.sh',
|
||||
configuration : test_confdata,
|
||||
)
|
|
@ -1,14 +1,24 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
if [[ -z "${COMMON_PATHS_SH_SOURCED-}" ]]; then
|
||||
|
||||
COMMON_PATHS_SH_SOURCED=1
|
||||
|
||||
commonDir="$(readlink -f "$(dirname "${BASH_SOURCE[0]-$0}")")"
|
||||
|
||||
# Since this is a generated file
|
||||
# Just for `isTestOnNixOS`
|
||||
source "$commonDir/functions.sh"
|
||||
# shellcheck disable=SC1091
|
||||
source "$commonDir/subst-vars.sh"
|
||||
source "${_NIX_TEST_BUILD_DIR}/common/subst-vars.sh"
|
||||
# Make sure shellcheck knows this will be defined by the above generated snippet
|
||||
: "${bindir?}"
|
||||
: "${bash?}" "${bindir?}"
|
||||
|
||||
export PATH="$bindir:$PATH"
|
||||
if ! isTestOnNixOS; then
|
||||
export SHELL="$bash"
|
||||
export PATH="$bindir:$PATH"
|
||||
fi
|
||||
|
||||
if [[ -n "${NIX_CLIENT_PACKAGE:-}" ]]; then
|
||||
export PATH="$NIX_CLIENT_PACKAGE/bin":$PATH
|
||||
|
@ -18,3 +28,5 @@ DAEMON_PATH="$PATH"
|
|||
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
|
||||
DAEMON_PATH="${NIX_DAEMON_PACKAGE}/bin:$DAEMON_PATH"
|
||||
fi
|
||||
|
||||
fi # COMMON_PATHS_SH_SOURCED
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
# NOTE: instances of @variable@ are substituted as defined in /mk/templates.mk
|
||||
# NOTE: instances of @variable@ are substituted by the build system
|
||||
|
||||
if [[ -z "${COMMON_SUBST_VARS_SH_SOURCED-}" ]]; then
|
||||
|
||||
COMMON_SUBST_VARS_SH_SOURCED=1
|
||||
|
||||
bash=@bash@
|
||||
bindir=@bindir@
|
||||
export coreutils=@coreutils@
|
||||
#lsof=@lsof@
|
||||
coreutils=@coreutils@
|
||||
|
||||
export dot=@dot@
|
||||
export PAGER=cat
|
||||
export busybox="@sandbox_shell@"
|
||||
dot=@dot@
|
||||
busybox="@sandbox_shell@"
|
||||
|
||||
export version=@PACKAGE_VERSION@
|
||||
export system=@system@
|
||||
|
||||
export BUILD_SHARED_LIBS=@BUILD_SHARED_LIBS@
|
||||
|
||||
if ! isTestOnNixOS; then
|
||||
export SHELL="@bash@"
|
||||
export PATH=@bindir@:$PATH
|
||||
fi
|
||||
version=@PACKAGE_VERSION@
|
||||
system=@system@
|
||||
|
||||
fi
|
||||
|
|
81
tests/functional/common/vars.sh
Normal file
81
tests/functional/common/vars.sh
Normal file
|
@ -0,0 +1,81 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
if [[ -z "${COMMON_VARS_SH_SOURCED-}" ]]; then
|
||||
|
||||
COMMON_VARS_SH_SOURCED=1
|
||||
|
||||
_NIX_TEST_SOURCE_DIR=$(realpath "${_NIX_TEST_SOURCE_DIR}")
|
||||
_NIX_TEST_BUILD_DIR=$(realpath "${_NIX_TEST_BUILD_DIR}")
|
||||
|
||||
commonDir="$(readlink -f "$(dirname "${BASH_SOURCE[0]-$0}")")"
|
||||
|
||||
# Since this is a generated file
|
||||
# shellcheck disable=SC1091
|
||||
source "${_NIX_TEST_BUILD_DIR}/common/subst-vars.sh"
|
||||
# Make sure shellcheck knows all these will be defined by the above generated snippet
|
||||
: "${bindir?} ${coreutils?} ${dot?} ${SHELL?} ${busybox?} ${version?} ${system?}"
|
||||
export coreutils dot busybox version system
|
||||
|
||||
export PAGER=cat
|
||||
|
||||
source "$commonDir/paths.sh"
|
||||
source "$commonDir/test-root.sh"
|
||||
|
||||
test_nix_conf_dir=$TEST_ROOT/etc
|
||||
# Used in other files
|
||||
# shellcheck disable=SC2034
|
||||
test_nix_conf=$test_nix_conf_dir/nix.conf
|
||||
|
||||
export TEST_HOME=$TEST_ROOT/test-home
|
||||
|
||||
if ! isTestOnNixOS; then
|
||||
export NIX_STORE_DIR
|
||||
if ! NIX_STORE_DIR=$(readlink -f "$TEST_ROOT/store" 2> /dev/null); then
|
||||
# Maybe the build directory is symlinked.
|
||||
export NIX_IGNORE_SYMLINK_STORE=1
|
||||
NIX_STORE_DIR=$TEST_ROOT/store
|
||||
fi
|
||||
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
|
||||
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
|
||||
export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||
export NIX_CONF_DIR=$test_nix_conf_dir
|
||||
export NIX_DAEMON_SOCKET_PATH=$TEST_ROOT/dSocket
|
||||
unset NIX_USER_CONF_FILES
|
||||
export _NIX_TEST_SHARED=$TEST_ROOT/shared
|
||||
if [[ -n $NIX_STORE ]]; then
|
||||
export _NIX_TEST_NO_SANDBOX=1
|
||||
fi
|
||||
export _NIX_IN_TEST=$TEST_ROOT/shared
|
||||
export _NIX_TEST_NO_LSOF=1
|
||||
export NIX_REMOTE=${NIX_REMOTE_-}
|
||||
|
||||
fi # ! isTestOnNixOS
|
||||
|
||||
unset NIX_PATH
|
||||
export HOME=$TEST_HOME
|
||||
unset XDG_STATE_HOME
|
||||
unset XDG_DATA_HOME
|
||||
unset XDG_CONFIG_HOME
|
||||
unset XDG_CONFIG_DIRS
|
||||
unset XDG_CACHE_HOME
|
||||
unset GIT_DIR
|
||||
|
||||
export IMPURE_VAR1=foo
|
||||
export IMPURE_VAR2=bar
|
||||
|
||||
# Used in other files
|
||||
# shellcheck disable=SC2034
|
||||
cacheDir=$TEST_ROOT/binary-cache
|
||||
|
||||
if [[ $(uname) == Linux ]] && [[ -L /proc/self/ns/user ]] && unshare --user true; then
|
||||
_canUseSandbox=1
|
||||
fi
|
||||
|
||||
# Very common, shorthand helps
|
||||
# Used in other files
|
||||
# shellcheck disable=SC2034
|
||||
config_nix="${_NIX_TEST_BUILD_DIR}/config.nix"
|
||||
|
||||
fi # COMMON_VARS_SH_SOURCED
|
Loading…
Add table
Add a link
Reference in a new issue