1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

shellcheck fix: tests/functional/parallel.sh

This commit is contained in:
Farid Zakaria 2025-09-29 10:05:59 -07:00
parent 4dc5dbaba2
commit ef17baf50d
2 changed files with 7 additions and 7 deletions

View file

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

View file

@ -1,3 +1,4 @@
# shellcheck shell=bash
source common.sh
@ -8,7 +9,7 @@ TODO_NixOS
clearStore
rm -f $_NIX_TEST_SHARED.cur $_NIX_TEST_SHARED.max
rm -f "$_NIX_TEST_SHARED".cur "$_NIX_TEST_SHARED".max
outPath=$(nix-build -j10000 parallel.nix --no-out-link)
@ -17,8 +18,8 @@ echo "output path is $outPath"
text=$(cat "$outPath")
if test "$text" != "abacade"; then exit 1; fi
if test "$(cat $_NIX_TEST_SHARED.cur)" != 0; then fail "wrong current process count"; fi
if test "$(cat $_NIX_TEST_SHARED.max)" != 3; then fail "not enough parallelism"; fi
if test "$(cat "$_NIX_TEST_SHARED".cur)" != 0; then fail "wrong current process count"; fi
if test "$(cat "$_NIX_TEST_SHARED".max)" != 3; then fail "not enough parallelism"; fi
# Second, test that parallel invocations of nix-build perform builds
@ -27,7 +28,7 @@ echo "testing multiple nix-build -j1..."
clearStore
rm -f $_NIX_TEST_SHARED.cur $_NIX_TEST_SHARED.max
rm -f "$_NIX_TEST_SHARED".cur "$_NIX_TEST_SHARED".max
drvPath=$(nix-instantiate parallel.nix --argstr sleepTime 15)
@ -54,5 +55,5 @@ wait $pid2 || fail "instance 2 failed: $?"
wait $pid3 || fail "instance 3 failed: $?"
wait $pid4 || fail "instance 4 failed: $?"
if test "$(cat $_NIX_TEST_SHARED.cur)" != 0; then fail "wrong current process count"; fi
if test "$(cat $_NIX_TEST_SHARED.max)" != 3; then fail "not enough parallelism"; fi
if test "$(cat "$_NIX_TEST_SHARED".cur)" != 0; then fail "wrong current process count"; fi
if test "$(cat "$_NIX_TEST_SHARED".max)" != 3; then fail "not enough parallelism"; fi