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/parallel.builder.sh

This commit is contained in:
Farid Zakaria 2025-09-29 10:05:33 -07:00
parent c09cf33a3a
commit 4dc5dbaba2
2 changed files with 16 additions and 15 deletions

View file

@ -106,7 +106,6 @@
enable = true;
excludes = [
# We haven't linted these files yet
''^tests/functional/parallel\.builder\.sh$''
''^tests/functional/parallel\.sh$''
''^tests/functional/pass-as-file\.sh$''
''^tests/functional/path-from-hash-part\.sh$''

View file

@ -1,29 +1,31 @@
# shellcheck shell=bash
# shellcheck disable=SC2154
echo "DOING $text"
# increase counter
while ! ln -s x $shared.lock 2> /dev/null; do
while ! ln -s x "$shared".lock 2> /dev/null; do
sleep 1
done
test -f $shared.cur || echo 0 > $shared.cur
test -f $shared.max || echo 0 > $shared.max
new=$(($(cat $shared.cur) + 1))
if test $new -gt $(cat $shared.max); then
echo $new > $shared.max
test -f "$shared".cur || echo 0 > "$shared".cur
test -f "$shared".max || echo 0 > "$shared".max
new=$(($(cat "$shared".cur) + 1))
if test $new -gt "$(cat "$shared".max)"; then
echo $new > "$shared".max
fi
echo $new > $shared.cur
rm $shared.lock
echo $new > "$shared".cur
rm "$shared".lock
echo -n $(cat $inputs)$text > $out
echo -n "$(cat "$inputs")""$text" > "$out"
sleep $sleepTime
sleep "$sleepTime"
# decrease counter
while ! ln -s x $shared.lock 2> /dev/null; do
while ! ln -s x "$shared".lock 2> /dev/null; do
sleep 1
done
test -f $shared.cur || echo 0 > $shared.cur
echo $(($(cat $shared.cur) - 1)) > $shared.cur
rm $shared.lock
test -f "$shared".cur || echo 0 > "$shared".cur
echo $(($(cat "$shared".cur) - 1)) > "$shared".cur
rm "$shared".lock