1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

Fix errors found by shellcheck in test script

This commit is contained in:
Guillaume Maudoux 2024-09-16 15:44:24 +02:00
parent 7e83ab3e35
commit 33d0762df1

View file

@ -7,38 +7,38 @@ TODO_NixOS
clearStore
drvPath=$(nix derivation instantiate --no-link --file simple.nix)
test -f $drvPath
nix-store --delete $drvPath
! test -f $drvPath
test -f "$drvPath"
nix-store --delete "$drvPath"
if test -f "$drvPath"; then false; fi
drvPath=$(nix derivation instantiate --file simple.nix)
test -f $drvPath
test -f "$drvPath"
test -e drv
nix-store --gc --print-roots | grep $drvPath
nix-store --gc --print-live | grep $drvPath
! nix-store --delete $drvPath
test -f $drvPath
[ "$(nix-store -q --roots $drvPath)" = "$(realpath --no-symlinks drv) -> $drvPath" ]
nix-store --gc --print-roots | grep "$drvPath"
nix-store --gc --print-live | grep "$drvPath"
if nix-store --delete "$drvPath"; then false; fi
test -f "$drvPath"
[ "$(nix-store -q --roots "$drvPath")" = "$(realpath --no-symlinks drv) -> $drvPath" ]
rm drv
nix-store --delete $drvPath
! test -f $drvPath
nix-store --delete "$drvPath"
if test -f "$drvPath"; then false; fi
drvPath=$(nix derivation instantiate --out-link foobar --file simple.nix)
test -e foobar
[ "$(nix-store -q --roots $drvPath)" = "$(realpath --no-symlinks foobar) -> $drvPath" ]
[ "$(nix-store -q --roots "$drvPath")" = "$(realpath --no-symlinks foobar) -> $drvPath" ]
rm foobar
nix-store --delete $drvPath
nix-store --delete "$drvPath"
drvPathJson=$(nix derivation instantiate --json --no-link --file simple.nix)
[ "$drvPathJson" = '{"'"$drvPath"'":{}}' ]
nix-store --delete $drvPath
[ "$drvPathJson" = "{\"$drvPath\":{}}" ]
nix-store --delete "$drvPath"
drvPaths=($(nix derivation instantiate --json --out-link multidrv --file check.nix | jq 'keys|.[]' -r))
mapfile -t drvPaths < <(nix derivation instantiate --json --out-link multidrv --file check.nix | jq 'keys|.[]' -r)
roots=(./multidrv*)
[ "${#roots[@]}" -gt 1 ]
[ "${#roots[@]}" -eq "${#drvPaths[@]}" ]
rootedPaths=($(readlink "${roots[@]}"))
mapfile -t rootedPaths < <(readlink "${roots[@]}")
[ "${rootedPaths[*]}" = "${drvPaths[*]}" ]
rm multidrv*
rm -f multidrv*
nix-collect-garbage