Merge pull request #10797 from obsidiansystems/shellcheck-tests

Shellcheck some test scripts
This commit is contained in:
Robert Hensing 2024-05-29 22:27:00 +02:00 committed by GitHub
commit 5df42223e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 359 additions and 71 deletions

2
.gitignore vendored
View file

@ -92,7 +92,7 @@ perl/Makefile.config
# /tests/functional/ # /tests/functional/
/tests/functional/test-tmp /tests/functional/test-tmp
/tests/functional/common/vars-and-functions.sh /tests/functional/common/subst-vars.sh
/tests/functional/result* /tests/functional/result*
/tests/functional/restricted-innocent /tests/functional/restricted-innocent
/tests/functional/shell /tests/functional/shell

View file

@ -514,18 +514,6 @@
''^tests/functional/brotli\.sh$'' ''^tests/functional/brotli\.sh$''
''^tests/functional/build-delete\.sh$'' ''^tests/functional/build-delete\.sh$''
''^tests/functional/build-dry\.sh$'' ''^tests/functional/build-dry\.sh$''
''^tests/functional/build-remote-content-addressed-fixed\.sh$''
''^tests/functional/build-remote-content-addressed-floating\.sh$''
''^tests/functional/build-remote-input-addressed\.sh$''
''^tests/functional/build-remote-trustless-after\.sh$''
''^tests/functional/build-remote-trustless-should-fail-0\.sh$''
''^tests/functional/build-remote-trustless-should-pass-0\.sh$''
''^tests/functional/build-remote-trustless-should-pass-1\.sh$''
''^tests/functional/build-remote-trustless-should-pass-2\.sh$''
''^tests/functional/build-remote-trustless-should-pass-3\.sh$''
''^tests/functional/build-remote-trustless\.sh$''
''^tests/functional/build-remote-with-mounted-ssh-ng\.sh$''
''^tests/functional/build-remote\.sh$''
''^tests/functional/build\.sh$'' ''^tests/functional/build\.sh$''
''^tests/functional/ca/build-cache\.sh$'' ''^tests/functional/ca/build-cache\.sh$''
''^tests/functional/ca/build-dry\.sh$'' ''^tests/functional/ca/build-dry\.sh$''
@ -554,8 +542,7 @@
''^tests/functional/check-reqs\.sh$'' ''^tests/functional/check-reqs\.sh$''
''^tests/functional/check\.sh$'' ''^tests/functional/check\.sh$''
''^tests/functional/chroot-store\.sh$'' ''^tests/functional/chroot-store\.sh$''
''^tests/functional/common\.sh$'' ''^tests/functional/common/vars-and-functions\.sh$''
''^tests/functional/common/init\.sh$''
''^tests/functional/completions\.sh$'' ''^tests/functional/completions\.sh$''
''^tests/functional/compression-levels\.sh$'' ''^tests/functional/compression-levels\.sh$''
''^tests/functional/compute-levels\.sh$'' ''^tests/functional/compute-levels\.sh$''

View file

@ -3,8 +3,7 @@
# Remove overall test dir (at most one of the two should match) and # Remove overall test dir (at most one of the two should match) and
# remove file extension. # remove file extension.
# shellcheck disable=SC2154 test_name=$(echo -n "${test?must be defined by caller (test runner)}" | sed \
test_name=$(echo -n "$test" | sed \
-e "s|^tests/unit/[^/]*/data/||" \ -e "s|^tests/unit/[^/]*/data/||" \
-e "s|^tests/functional/||" \ -e "s|^tests/functional/||" \
-e "s|\.sh$||" \ -e "s|\.sh$||" \

2
tests/functional/add.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
path1=$(nix-store --add ./dummy) path1=$(nix-store --add ./dummy)

2
tests/functional/bash-profile.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
sed -e "s|@localstatedir@|$TEST_ROOT/profile-var|g" -e "s|@coreutils@|$coreutils|g" < ../../scripts/nix-profile.sh.in > $TEST_ROOT/nix-profile.sh sed -e "s|@localstatedir@|$TEST_ROOT/profile-var|g" -e "s|@coreutils@|$coreutils|g" < ../../scripts/nix-profile.sh.in > $TEST_ROOT/nix-profile.sh

2
tests/functional/binary-cache-build-remote.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/binary-cache.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
needLocalStore "'--no-require-sigs' cant be used with the daemon" needLocalStore "'--no-require-sigs' cant be used with the daemon"

2
tests/functional/brotli.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/build-delete.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/build-dry.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
################################################### ###################################################

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
file=build-hook-ca-fixed.nix file=build-hook-ca-fixed.nix

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
file=build-hook-ca-floating.nix file=build-hook-ca-floating.nix

12
tests/functional/build-remote-input-addressed.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
file=build-hook.nix file=build-hook.nix
@ -11,17 +13,17 @@ registerBuildHook () {
# Dummy post-build-hook just to ensure that it's executed correctly. # Dummy post-build-hook just to ensure that it's executed correctly.
# (we can't reuse the one from `$PWD/push-to-store.sh` because of # (we can't reuse the one from `$PWD/push-to-store.sh` because of
# https://github.com/NixOS/nix/issues/4341) # https://github.com/NixOS/nix/issues/4341)
cat <<EOF > $TEST_ROOT/post-build-hook.sh cat <<EOF > "$TEST_ROOT/post-build-hook.sh"
#!/bin/sh #!/bin/sh
echo "Post hook ran successfully" echo "Post hook ran successfully"
# Add an empty line to a counter file, just to check that this hook ran properly # Add an empty line to a counter file, just to check that this hook ran properly
echo "" >> $TEST_ROOT/post-hook-counter echo "" >> $TEST_ROOT/post-hook-counter
EOF EOF
chmod +x $TEST_ROOT/post-build-hook.sh chmod +x "$TEST_ROOT/post-build-hook.sh"
rm -f $TEST_ROOT/post-hook-counter rm -f "$TEST_ROOT/post-hook-counter"
echo "post-build-hook = $TEST_ROOT/post-build-hook.sh" >> $NIX_CONF_DIR/nix.conf echo "post-build-hook = $TEST_ROOT/post-build-hook.sh" >> "$NIX_CONF_DIR/nix.conf"
} }
registerBuildHook registerBuildHook
@ -30,4 +32,4 @@ source build-remote.sh
# `build-hook.nix` has four derivations to build, and the hook runs twice for # `build-hook.nix` has four derivations to build, and the hook runs twice for
# each derivation (once on the builder and once on the host), so the counter # each derivation (once on the builder and once on the host), so the counter
# should contain eight lines now # should contain eight lines now
[[ $(cat $TEST_ROOT/post-hook-counter | wc -l) -eq 8 ]] [[ $(wc -l < "$TEST_ROOT/post-hook-counter") -eq 8 ]]

View file

@ -1,2 +1,7 @@
outPath=$(readlink -f $TEST_ROOT/result) # shellcheck shell=bash
grep 'FOO BAR BAZ' ${remoteDir}/${outPath}
# Variables must be defined by caller, so
# shellcheck disable=SC2154
outPath=$(readlink -f "$TEST_ROOT/result")
grep 'FOO BAR BAZ' "${remoteDir}/${outPath}"

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
enableFeatures "daemon-trust-override" enableFeatures "daemon-trust-override"
@ -22,8 +24,12 @@ nix-build build-hook.nix -A passthru.input2 \
# copy our already-build `input2` to the remote store. That store object # copy our already-build `input2` to the remote store. That store object
# is input-addressed, so this will fail. # is input-addressed, so this will fail.
# For script below
# shellcheck disable=SC2034
file=build-hook.nix file=build-hook.nix
# shellcheck disable=SC2034
prog=$(readlink -e ./nix-daemon-untrusting.sh) prog=$(readlink -e ./nix-daemon-untrusting.sh)
# shellcheck disable=SC2034
proto=ssh-ng proto=ssh-ng
expectStderr 1 source build-remote-trustless.sh \ expectStderr 1 source build-remote-trustless.sh \

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Remote trusts us # Remote trusts us

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Remote trusts us # Remote trusts us

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
enableFeatures "daemon-trust-override" enableFeatures "daemon-trust-override"

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
enableFeatures "daemon-trust-override" enableFeatures "daemon-trust-override"

View file

@ -1,5 +1,11 @@
# shellcheck shell=bash
# All variables should be defined externally by the scripts that source
# this, `set -u` will catch any that are forgotten.
# shellcheck disable=SC2154
requireSandboxSupport requireSandboxSupport
[[ $busybox =~ busybox ]] || skipTest "no busybox" [[ "$busybox" =~ busybox ]] || skipTest "no busybox"
unset NIX_STORE_DIR unset NIX_STORE_DIR
unset NIX_STATE_DIR unset NIX_STATE_DIR
@ -8,7 +14,7 @@ remoteDir=$TEST_ROOT/remote
# Note: ssh{-ng}://localhost bypasses ssh. See tests/functional/build-remote.sh for # Note: ssh{-ng}://localhost bypasses ssh. See tests/functional/build-remote.sh for
# more details. # more details.
nix-build $file -o $TEST_ROOT/result --max-jobs 0 \ nix-build "$file" -o "$TEST_ROOT/result" --max-jobs 0 \
--arg busybox $busybox \ --arg busybox "$busybox" \
--store $TEST_ROOT/local \ --store "$TEST_ROOT/local" \
--builders "$proto://localhost?remote-program=$prog&remote-store=${remoteDir}%3Fsystem-features=foo%20bar%20baz - - 1 1 foo,bar,baz" --builders "$proto://localhost?remote-program=$prog&remote-store=${remoteDir}%3Fsystem-features=foo%20bar%20baz - - 1 1 foo,bar,baz"

14
tests/functional/build-remote-with-mounted-ssh-ng.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
requireSandboxSupport requireSandboxSupport
@ -6,17 +8,17 @@ requireSandboxSupport
enableFeatures mounted-ssh-store enableFeatures mounted-ssh-store
nix build -Lvf simple.nix \ nix build -Lvf simple.nix \
--arg busybox $busybox \ --arg busybox "$busybox" \
--out-link $TEST_ROOT/result-from-remote \ --out-link "$TEST_ROOT/result-from-remote" \
--store mounted-ssh-ng://localhost --store mounted-ssh-ng://localhost
nix build -Lvf simple.nix \ nix build -Lvf simple.nix \
--arg busybox $busybox \ --arg busybox "$busybox" \
--out-link $TEST_ROOT/result-from-remote-new-cli \ --out-link "$TEST_ROOT/result-from-remote-new-cli" \
--store 'mounted-ssh-ng://localhost?remote-program=nix daemon' --store 'mounted-ssh-ng://localhost?remote-program=nix daemon'
# This verifies that the out link was actually created and valid. The ability # This verifies that the out link was actually created and valid. The ability
# to create out links (permanent gc roots) is the distinguishing feature of # to create out links (permanent gc roots) is the distinguishing feature of
# the mounted-ssh-ng store. # the mounted-ssh-ng store.
cat $TEST_ROOT/result-from-remote/hello | grepQuiet 'Hello World!' grepQuiet 'Hello World!' < "$TEST_ROOT/result-from-remote/hello"
cat $TEST_ROOT/result-from-remote-new-cli/hello | grepQuiet 'Hello World!' grepQuiet 'Hello World!' < "$TEST_ROOT/result-from-remote-new-cli/hello"

View file

@ -1,5 +1,9 @@
# shellcheck shell=bash
: "${file?must be defined by caller (remote building test case using this)}"
requireSandboxSupport requireSandboxSupport
[[ $busybox =~ busybox ]] || skipTest "no busybox" [[ "${busybox-}" =~ busybox ]] || skipTest "no busybox"
# Avoid store dir being inside sandbox build-dir # Avoid store dir being inside sandbox build-dir
unset NIX_STORE_DIR unset NIX_STORE_DIR
@ -15,50 +19,50 @@ fi
builders=( builders=(
# system-features will automatically be added to the outer URL, but not inner # system-features will automatically be added to the outer URL, but not inner
# remote-store URL. # remote-store URL.
"ssh://localhost?remote-store=$TEST_ROOT/machine1?system-features=$(join_by "%20" foo ${EXTRA_SYSTEM_FEATURES[@]}) - - 1 1 $(join_by "," foo ${EXTRA_SYSTEM_FEATURES[@]})" "ssh://localhost?remote-store=$TEST_ROOT/machine1?system-features=$(join_by "%20" foo "${EXTRA_SYSTEM_FEATURES[@]}") - - 1 1 $(join_by "," foo "${EXTRA_SYSTEM_FEATURES[@]}")"
"$TEST_ROOT/machine2 - - 1 1 $(join_by "," bar ${EXTRA_SYSTEM_FEATURES[@]})" "$TEST_ROOT/machine2 - - 1 1 $(join_by "," bar "${EXTRA_SYSTEM_FEATURES[@]}")"
"ssh-ng://localhost?remote-store=$TEST_ROOT/machine3?system-features=$(join_by "%20" baz ${EXTRA_SYSTEM_FEATURES[@]}) - - 1 1 $(join_by "," baz ${EXTRA_SYSTEM_FEATURES[@]})" "ssh-ng://localhost?remote-store=$TEST_ROOT/machine3?system-features=$(join_by "%20" baz "${EXTRA_SYSTEM_FEATURES[@]}") - - 1 1 $(join_by "," baz "${EXTRA_SYSTEM_FEATURES[@]}")"
) )
chmod -R +w $TEST_ROOT/machine* || true chmod -R +w "$TEST_ROOT/machine"* || true
rm -rf $TEST_ROOT/machine* || true rm -rf "$TEST_ROOT/machine"* || true
# Note: ssh://localhost bypasses ssh, directly invoking nix-store as a # Note: ssh://localhost bypasses ssh, directly invoking nix-store as a
# child process. This allows us to test LegacySSHStore::buildDerivation(). # child process. This allows us to test LegacySSHStore::buildDerivation().
# ssh-ng://... likewise allows us to test RemoteStore::buildDerivation(). # ssh-ng://... likewise allows us to test RemoteStore::buildDerivation().
nix build -L -v -f $file -o $TEST_ROOT/result --max-jobs 0 \ nix build -L -v -f "$file" -o "$TEST_ROOT/result" --max-jobs 0 \
--arg busybox $busybox \ --arg busybox "$busybox" \
--store $TEST_ROOT/machine0 \ --store "$TEST_ROOT/machine0" \
--builders "$(join_by '; ' "${builders[@]}")" --builders "$(join_by '; ' "${builders[@]}")"
outPath=$(readlink -f $TEST_ROOT/result) outPath=$(readlink -f "$TEST_ROOT/result")
grep 'FOO BAR BAZ' $TEST_ROOT/machine0/$outPath grep 'FOO BAR BAZ' "$TEST_ROOT/machine0/$outPath"
testPrintOutPath=$(nix build -L -v -f $file --no-link --print-out-paths --max-jobs 0 \ testPrintOutPath=$(nix build -L -v -f "$file" --no-link --print-out-paths --max-jobs 0 \
--arg busybox $busybox \ --arg busybox "$busybox" \
--store $TEST_ROOT/machine0 \ --store "$TEST_ROOT/machine0" \
--builders "$(join_by '; ' "${builders[@]}")" --builders "$(join_by '; ' "${builders[@]}")"
) )
[[ $testPrintOutPath =~ store.*build-remote ]] [[ $testPrintOutPath =~ store.*build-remote ]]
# Ensure that input1 was built on store1 due to the required feature. # Ensure that input1 was built on store1 due to the required feature.
output=$(nix path-info --store $TEST_ROOT/machine1 --all) output=$(nix path-info --store "$TEST_ROOT/machine1" --all)
echo "$output" | grepQuiet builder-build-remote-input-1.sh echo "$output" | grepQuiet builder-build-remote-input-1.sh
echo "$output" | grepQuietInverse builder-build-remote-input-2.sh echo "$output" | grepQuietInverse builder-build-remote-input-2.sh
echo "$output" | grepQuietInverse builder-build-remote-input-3.sh echo "$output" | grepQuietInverse builder-build-remote-input-3.sh
unset output unset output
# Ensure that input2 was built on store2 due to the required feature. # Ensure that input2 was built on store2 due to the required feature.
output=$(nix path-info --store $TEST_ROOT/machine2 --all) output=$(nix path-info --store "$TEST_ROOT/machine2" --all)
echo "$output" | grepQuietInverse builder-build-remote-input-1.sh echo "$output" | grepQuietInverse builder-build-remote-input-1.sh
echo "$output" | grepQuiet builder-build-remote-input-2.sh echo "$output" | grepQuiet builder-build-remote-input-2.sh
echo "$output" | grepQuietInverse builder-build-remote-input-3.sh echo "$output" | grepQuietInverse builder-build-remote-input-3.sh
unset output unset output
# Ensure that input3 was built on store3 due to the required feature. # Ensure that input3 was built on store3 due to the required feature.
output=$(nix path-info --store $TEST_ROOT/machine3 --all) output=$(nix path-info --store "$TEST_ROOT/machine3" --all)
echo "$output" | grepQuietInverse builder-build-remote-input-1.sh echo "$output" | grepQuietInverse builder-build-remote-input-1.sh
echo "$output" | grepQuietInverse builder-build-remote-input-2.sh echo "$output" | grepQuietInverse builder-build-remote-input-2.sh
echo "$output" | grepQuiet builder-build-remote-input-3.sh echo "$output" | grepQuiet builder-build-remote-input-3.sh
@ -66,7 +70,7 @@ unset output
for i in input1 input3; do for i in input1 input3; do
nix log --store $TEST_ROOT/machine0 --file "$file" --arg busybox $busybox passthru."$i" | grep hi-$i nix log --store "$TEST_ROOT/machine0" --file "$file" --arg busybox "$busybox" "passthru.$i" | grep hi-$i
done done
# Behavior of keep-failed # Behavior of keep-failed
@ -74,9 +78,9 @@ out="$(nix-build 2>&1 failing.nix \
--no-out-link \ --no-out-link \
--builders "$(join_by '; ' "${builders[@]}")" \ --builders "$(join_by '; ' "${builders[@]}")" \
--keep-failed \ --keep-failed \
--store $TEST_ROOT/machine0 \ --store "$TEST_ROOT/machine0" \
-j0 \ -j0 \
--arg busybox $busybox)" || true --arg busybox "$busybox")" || true
[[ "$out" =~ .*"note: keeping build directory".* ]] [[ "$out" =~ .*"note: keeping build directory".* ]]

2
tests/functional/build.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/case-hack.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/check-refs.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/check-reqs.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/check.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# XXX: This shouldnt be, but #4813 cause this test to fail # XXX: This shouldnt be, but #4813 cause this test to fail

2
tests/functional/chroot-store.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
echo example > $TEST_ROOT/example.txt echo example > $TEST_ROOT/example.txt

View file

@ -1,13 +1,15 @@
# shellcheck shell=bash
set -eu -o pipefail set -eu -o pipefail
if [[ -z "${COMMON_SH_SOURCED-}" ]]; then if [[ -z "${COMMON_SH_SOURCED-}" ]]; then
COMMON_SH_SOURCED=1 COMMON_SH_SOURCED=1
dir="$(readlink -f "$(dirname "${BASH_SOURCE[0]-$0}")")" functionalTestsDir="$(readlink -f "$(dirname "${BASH_SOURCE[0]-$0}")")"
source "$dir"/common/vars-and-functions.sh source "$functionalTestsDir/common/vars-and-functions.sh"
source "$dir"/common/init.sh source "$functionalTestsDir/common/init.sh"
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
startDaemon startDaemon

View file

@ -1,3 +1,5 @@
# shellcheck shell=bash
test -n "$TEST_ROOT" test -n "$TEST_ROOT"
# We would delete any daemon socket, so let's stop the daemon first. # We would delete any daemon socket, so let's stop the daemon first.
killDaemon killDaemon

View file

@ -0,0 +1,15 @@
# NOTE: instances of @variable@ are substituted as defined in /mk/templates.mk
export PATH=@bindir@:$PATH
export coreutils=@coreutils@
#lsof=@lsof@
export dot=@dot@
export SHELL="@bash@"
export PAGER=cat
export busybox="@sandbox_shell@"
export version=@PACKAGE_VERSION@
export system=@system@
export BUILD_SHARED_LIBS=@BUILD_SHARED_LIBS@

View file

@ -8,6 +8,12 @@ COMMON_VARS_AND_FUNCTIONS_SH_SOURCED=1
set +x 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
: "${PATH?} ${coreutils?} ${dot?} ${SHELL?} ${PAGER?} ${busybox?} ${version?} ${system?} ${BUILD_SHARED_LIBS?}"
export TEST_ROOT=$(realpath ${TMPDIR:-/tmp}/nix-test)/${TEST_NAME:-default/tests\/functional//} export TEST_ROOT=$(realpath ${TMPDIR:-/tmp}/nix-test)/${TEST_NAME:-default/tests\/functional//}
export NIX_STORE_DIR export NIX_STORE_DIR
if ! NIX_STORE_DIR=$(readlink -f $TEST_ROOT/store 2> /dev/null); then if ! NIX_STORE_DIR=$(readlink -f $TEST_ROOT/store 2> /dev/null); then
@ -37,7 +43,6 @@ unset XDG_CONFIG_HOME
unset XDG_CONFIG_DIRS unset XDG_CONFIG_DIRS
unset XDG_CACHE_HOME unset XDG_CACHE_HOME
export PATH=@bindir@:$PATH
if [[ -n "${NIX_CLIENT_PACKAGE:-}" ]]; then if [[ -n "${NIX_CLIENT_PACKAGE:-}" ]]; then
export PATH="$NIX_CLIENT_PACKAGE/bin":$PATH export PATH="$NIX_CLIENT_PACKAGE/bin":$PATH
fi fi
@ -45,18 +50,6 @@ DAEMON_PATH="$PATH"
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
DAEMON_PATH="${NIX_DAEMON_PACKAGE}/bin:$DAEMON_PATH" DAEMON_PATH="${NIX_DAEMON_PACKAGE}/bin:$DAEMON_PATH"
fi fi
coreutils=@coreutils@
lsof=@lsof@
export dot=@dot@
export SHELL="@bash@"
export PAGER=cat
export busybox="@sandbox_shell@"
export version=@PACKAGE_VERSION@
export system=@system@
export BUILD_SHARED_LIBS=@BUILD_SHARED_LIBS@
export IMPURE_VAR1=foo export IMPURE_VAR1=foo
export IMPURE_VAR2=bar export IMPURE_VAR2=bar

2
tests/functional/completions.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
cd "$TEST_ROOT" cd "$TEST_ROOT"

2
tests/functional/compression-levels.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/compute-levels.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
if [[ $(uname -ms) = "Linux x86_64" ]]; then if [[ $(uname -ms) = "Linux x86_64" ]]; then

2
tests/functional/config.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Isolate the home for this test. # Isolate the home for this test.

2
tests/functional/db-migration.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# Test that we can successfully migrate from an older db schema # Test that we can successfully migrate from an older db schema
source common.sh source common.sh

2
tests/functional/debugger.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/dependencies.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/derivation-json.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
drvPath=$(nix-instantiate simple.nix) drvPath=$(nix-instantiate simple.nix)

2
tests/functional/dump-db.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
needLocalStore "--dump-db requires a local store" needLocalStore "--dump-db requires a local store"

2
tests/functional/eval-store.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Using `--eval-store` with the daemon will eventually copy everything # Using `--eval-store` with the daemon will eventually copy everything

2
tests/functional/eval.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/experimental-features.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Skipping these two for now, because we actually *do* want flags and # Skipping these two for now, because we actually *do* want flags and

2
tests/functional/export-graph.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/export.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/extra-sandbox-profile.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
if [[ $(uname) != Darwin ]]; then skipTest "Need Darwin"; fi if [[ $(uname) != Darwin ]]; then skipTest "Need Darwin"; fi

2
tests/functional/fetchClosure.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
enableFeatures "fetch-closure" enableFeatures "fetch-closure"

2
tests/functional/fetchGit.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
requireGit requireGit

2
tests/functional/fetchGitRefs.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
requireGit requireGit

2
tests/functional/fetchGitSubmodules.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
set -u set -u

2
tests/functional/fetchGitVerification.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
requireGit requireGit

2
tests/functional/fetchMercurial.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
[[ $(type -p hg) ]] || skipTest "Mercurial not installed" [[ $(type -p hg) ]] || skipTest "Mercurial not installed"

2
tests/functional/fetchPath.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
touch $TEST_ROOT/foo -t 202211111111 touch $TEST_ROOT/foo -t 202211111111

2
tests/functional/fetchTree-file.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/fetchurl.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/filter-source.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
rm -rf $TEST_ROOT/filterin rm -rf $TEST_ROOT/filterin

2
tests/functional/fixed.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/flakes/absolute-attr-paths.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
flake1Dir=$TEST_ROOT/flake1 flake1Dir=$TEST_ROOT/flake1

2
tests/functional/flakes/absolute-paths.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
requireGit requireGit

2
tests/functional/flakes/build-paths.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
flake1Dir=$TEST_ROOT/flake1 flake1Dir=$TEST_ROOT/flake1

2
tests/functional/flakes/bundle.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
cp ../simple.nix ../simple.builder.sh ../config.nix $TEST_HOME cp ../simple.nix ../simple.builder.sh ../config.nix $TEST_HOME

2
tests/functional/flakes/check.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
flakeDir=$TEST_ROOT/flake3 flakeDir=$TEST_ROOT/flake3

2
tests/functional/flakes/circular.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# Test circular flake dependencies. # Test circular flake dependencies.
source ./common.sh source ./common.sh

2
tests/functional/flakes/config.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
cp ../simple.nix ../simple.builder.sh ../config.nix $TEST_HOME cp ../simple.nix ../simple.builder.sh ../config.nix $TEST_HOME

2
tests/functional/flakes/develop.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ../common.sh source ../common.sh
clearStore clearStore

2
tests/functional/flakes/flake-in-submodule.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Tests that: # Tests that:

2
tests/functional/flakes/flakes.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
requireGit requireGit

2
tests/functional/flakes/follow-paths.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
requireGit requireGit

2
tests/functional/flakes/init.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
requireGit requireGit

2
tests/functional/flakes/inputs.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
requireGit requireGit

2
tests/functional/flakes/mercurial.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
[[ $(type -p hg) ]] || skipTest "Mercurial not installed" [[ $(type -p hg) ]] || skipTest "Mercurial not installed"

2
tests/functional/flakes/prefetch.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Test symlinks in zip files (#10649). # Test symlinks in zip files (#10649).

2
tests/functional/flakes/run.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ../common.sh source ../common.sh
clearStore clearStore

2
tests/functional/flakes/search-root.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/flakes/show.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
flakeDir=$TEST_ROOT/flake flakeDir=$TEST_ROOT/flake

2
tests/functional/flakes/unlocked-override.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source ./common.sh source ./common.sh
requireGit requireGit

2
tests/functional/fmt.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
set +x set +x

2
tests/functional/gc-auto.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
needLocalStore "“min-free” and “max-free” are daemon options" needLocalStore "“min-free” and “max-free” are daemon options"

2
tests/functional/gc-concurrent.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/gc-non-blocking.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# Test whether the collector is non-blocking, i.e. a build can run in # Test whether the collector is non-blocking, i.e. a build can run in
# parallel with it. # parallel with it.
source common.sh source common.sh

2
tests/functional/gc-runtime.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
case $system in case $system in

2
tests/functional/gc.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/hash-convert.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Conversion with `nix hash` `nix-hash` and `nix hash convert` # Conversion with `nix hash` `nix-hash` and `nix hash convert`

2
tests/functional/hash-path.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
try () { try () {

2
tests/functional/help.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/import-derivation.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/impure-derivations.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
requireDaemonNewerThan "2.8pre20220311" requireDaemonNewerThan "2.8pre20220311"

2
tests/functional/impure-env.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Needs the config option 'impure-env' to work # Needs the config option 'impure-env' to work

2
tests/functional/impure-eval.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
export REMOTE_STORE="dummy://" export REMOTE_STORE="dummy://"

2
tests/functional/lang-test-infra.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# Test the function for lang.sh # Test the function for lang.sh
source common.sh source common.sh

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
set -o pipefail set -o pipefail

2
tests/functional/legacy-ssh-store.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
store_uri="ssh://localhost?remote-store=$TEST_ROOT/other-store" store_uri="ssh://localhost?remote-store=$TEST_ROOT/other-store"

2
tests/functional/linux-sandbox.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
needLocalStore "the sandbox only runs on the builder side, so it makes no sense to test it with the daemon" needLocalStore "the sandbox only runs on the builder side, so it makes no sense to test it with the daemon"

View file

@ -153,7 +153,7 @@ $(d)/plugins.sh.test $(d)/plugins.sh.test-debug: \
install-tests += $(foreach x, $(nix_tests), $(d)/$(x)) install-tests += $(foreach x, $(nix_tests), $(d)/$(x))
test-clean-files := \ test-clean-files := \
$(d)/common/vars-and-functions.sh \ $(d)/common/subst-vars.sh \
$(d)/config.nix $(d)/config.nix
clean-files += $(test-clean-files) clean-files += $(test-clean-files)

2
tests/functional/logging.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/misc.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
# Tests miscellaneous commands. # Tests miscellaneous commands.

2
tests/functional/multiple-outputs.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
clearStore clearStore

2
tests/functional/nar-access.sh Normal file → Executable file
View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
source common.sh source common.sh
echo "building test path" echo "building test path"

Some files were not shown because too many files have changed in this diff Show more