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/logging.sh

This commit is contained in:
Farid Zakaria 2025-09-29 09:28:39 -07:00
parent c4da98c8f4
commit 5a13f9fc91
2 changed files with 5 additions and 6 deletions

View file

@ -106,7 +106,6 @@
enable = true; enable = true;
excludes = [ excludes = [
# We haven't linted these files yet # We haven't linted these files yet
''^tests/functional/logging\.sh$''
''^tests/functional/misc\.sh$'' ''^tests/functional/misc\.sh$''
''^tests/functional/multiple-outputs\.sh$'' ''^tests/functional/multiple-outputs\.sh$''
''^tests/functional/nested-sandboxing\.sh$'' ''^tests/functional/nested-sandboxing\.sh$''

View file

@ -9,14 +9,14 @@ clearStore
path=$(nix-build dependencies.nix --no-out-link) path=$(nix-build dependencies.nix --no-out-link)
# Test nix-store -l. # Test nix-store -l.
[ "$(nix-store -l $path)" = FOO ] [ "$(nix-store -l "$path")" = FOO ]
# Test compressed logs. # Test compressed logs.
clearStore clearStore
rm -rf $NIX_LOG_DIR rm -rf "$NIX_LOG_DIR"
(! nix-store -l $path) (! nix-store -l "$path")
nix-build dependencies.nix --no-out-link --compress-build-log nix-build dependencies.nix --no-out-link --compress-build-log
[ "$(nix-store -l $path)" = FOO ] [ "$(nix-store -l "$path")" = FOO ]
# test whether empty logs work fine with `nix log`. # test whether empty logs work fine with `nix log`.
builder="$(realpath "$(mktemp)")" builder="$(realpath "$(mktemp)")"
@ -40,5 +40,5 @@ if [[ "$NIX_REMOTE" != "daemon" ]]; then
nix build -vv --file dependencies.nix --no-link --json-log-path "$TEST_ROOT/log.json" 2>&1 | grepQuiet 'building.*dependencies-top.drv' nix build -vv --file dependencies.nix --no-link --json-log-path "$TEST_ROOT/log.json" 2>&1 | grepQuiet 'building.*dependencies-top.drv'
jq < "$TEST_ROOT/log.json" jq < "$TEST_ROOT/log.json"
grep '{"action":"start","fields":\[".*-dependencies-top.drv","",1,1\],"id":.*,"level":3,"parent":0' "$TEST_ROOT/log.json" >&2 grep '{"action":"start","fields":\[".*-dependencies-top.drv","",1,1\],"id":.*,"level":3,"parent":0' "$TEST_ROOT/log.json" >&2
(( $(grep '{"action":"msg","level":5,"msg":"executing builder .*"}' "$TEST_ROOT/log.json" | wc -l) == 5 )) (( $(grep -c '{"action":"msg","level":5,"msg":"executing builder .*"}' "$TEST_ROOT/log.json" ) == 5 ))
fi fi