1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

shellcheck fix: tests/functional/gc-auto.sh

This commit is contained in:
Farid Zakaria 2025-09-29 09:18:50 -07:00
parent 08a82f4682
commit 4192ca9131
2 changed files with 13 additions and 10 deletions

View file

@ -106,7 +106,6 @@
enable = true;
excludes = [
# We haven't linted these files yet
''^tests/functional/gc-auto\.sh$''
''^tests/functional/gc-concurrent\.builder\.sh$''
''^tests/functional/gc-concurrent\.sh$''
''^tests/functional/gc-concurrent2\.builder\.sh$''

View file

@ -2,22 +2,26 @@
source common.sh
# shellcheck disable=SC1111
needLocalStore "“min-free” and “max-free” are daemon options"
TODO_NixOS
clearStore
# shellcheck disable=SC2034
garbage1=$(nix store add-path --name garbage1 ./nar-access.sh)
# shellcheck disable=SC2034
garbage2=$(nix store add-path --name garbage2 ./nar-access.sh)
# shellcheck disable=SC2034
garbage3=$(nix store add-path --name garbage3 ./nar-access.sh)
ls -l $garbage3
POSIXLY_CORRECT=1 du $garbage3
ls -l "$garbage3"
POSIXLY_CORRECT=1 du "$garbage3"
fake_free=$TEST_ROOT/fake-free
export _NIX_TEST_FREE_SPACE_FILE=$fake_free
echo 1100 > $fake_free
echo 1100 > "$fake_free"
fifoLock=$TEST_ROOT/fifoLock
mkfifo "$fifoLock"
@ -65,11 +69,11 @@ with import ${config_nix}; mkDerivation {
EOF
)
nix build --impure -v -o $TEST_ROOT/result-A -L --expr "$expr" \
nix build --impure -v -o "$TEST_ROOT"/result-A -L --expr "$expr" \
--min-free 1K --max-free 2K --min-free-check-interval 1 &
pid1=$!
nix build --impure -v -o $TEST_ROOT/result-B -L --expr "$expr2" \
nix build --impure -v -o "$TEST_ROOT"/result-B -L --expr "$expr2" \
--min-free 1K --max-free 2K --min-free-check-interval 1 &
pid2=$!
@ -77,9 +81,9 @@ pid2=$!
# If the first build fails, we need to postpone the failure to still allow
# the second one to finish
wait "$pid1" || FIRSTBUILDSTATUS=$?
echo "unlock" > $fifoLock
( exit ${FIRSTBUILDSTATUS:-0} )
echo "unlock" > "$fifoLock"
( exit "${FIRSTBUILDSTATUS:-0}" )
wait "$pid2"
[[ foo = $(cat $TEST_ROOT/result-A/bar) ]]
[[ foo = $(cat $TEST_ROOT/result-B/bar) ]]
[[ foo = $(cat "$TEST_ROOT"/result-A/bar) ]]
[[ foo = $(cat "$TEST_ROOT"/result-B/bar) ]]