1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

Merge remote-tracking branch 'origin/2.26-maintenance' into detsys-main

This commit is contained in:
Eelco Dolstra 2025-02-24 22:41:22 +01:00
commit 6749d26dbb
59 changed files with 708 additions and 403 deletions

View file

@ -67,7 +67,7 @@ startDaemon() {
die "startDaemon: not supported when testing on NixOS. Is it really needed? If so add conditionals; e.g. if ! isTestOnNixOS; then ..."
fi
# Dont start the daemon twice, as this would just make it loop indefinitely
# Don't start the daemon twice, as this would just make it loop indefinitely.
if [[ "${_NIX_TEST_DAEMON_PID-}" != '' ]]; then
return
fi
@ -77,15 +77,19 @@ startDaemon() {
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
for ((i = 0; i < 60; i++)); do
if [[ -S $NIX_DAEMON_SOCKET_PATH ]]; then
DAEMON_STARTED=1
break;
fi
if ! kill -0 "$_NIX_TEST_DAEMON_PID"; then
echo "daemon died unexpectedly" >&2
exit 1
fi
sleep 0.1
done
if [[ -z ${DAEMON_STARTED+x} ]]; then
fail "Didnt manage to start the daemon"
fail "Didn't manage to start the daemon"
fi
trap "killDaemon" EXIT
# Save for if daemon is killed
@ -98,7 +102,7 @@ killDaemon() {
die "killDaemon: not supported when testing on NixOS. Is it really needed? If so add conditionals; e.g. if ! isTestOnNixOS; then ..."
fi
# Dont fail trying to stop a non-existant daemon twice
# Don't fail trying to stop a non-existant daemon twice.
if [[ "${_NIX_TEST_DAEMON_PID-}" == '' ]]; then
return
fi
@ -220,7 +224,7 @@ assertStderr() {
needLocalStore() {
if [[ "$NIX_REMOTE" == "daemon" ]]; then
skipTest "Cant run through the daemon ($1)"
skipTest "Can't run through the daemon ($1)"
fi
}

View file

@ -76,6 +76,9 @@ if ! isTestOnNixOS; then
fi
(! grep narHash "$subflake2/flake.lock")
# Test `nix flake archive` with relative path flakes.
nix flake archive --json "$rootFlake"
# Test circular relative path flakes. FIXME: doesn't work at the moment.
if false; then

View file

@ -11,7 +11,7 @@ source common.sh
#nix-hash --help | grepQuiet base32
# Can we ask for the version number?
nix-env --version | grep "$version"
nix-env --version | grep -F "${_NIX_TEST_CLIENT_VERSION:-$version}"
nix_env=$(type -P nix-env)
(PATH=""; ! $nix_env --help 2>&1 ) | grepQuiet -F "The 'man' command was not found, but it is needed for 'nix-env' and some other 'nix-*' commands' help text. Perhaps you could install the 'man' command?"

View file

@ -75,16 +75,10 @@ mkMesonDerivation (
];
preConfigure =
# "Inline" .version so it's not a symlink, and includes the suffix.
# Do the meson utils, without modification.
''
chmod u+w ./.version
echo ${version} > ../../../.version
''
# TEMP hack for Meson before make is gone, where
# `src/nix-functional-tests` is during the transition a symlink and
# not the actual directory directory.
+ ''
''
cd $(readlink -e $PWD)
echo $PWD | grep tests/functional
'';
@ -105,6 +99,8 @@ mkMesonDerivation (
}
// lib.optionalAttrs (test-daemon != null) {
# TODO rename to _NIX_TEST_DAEMON_PACKAGE
NIX_DAEMON_PACKAGE = test-daemon;
_NIX_TEST_CLIENT_VERSION = nix-cli.version;
}
)