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/local-overlay-store/check-post-init.sh

This commit is contained in:
Farid Zakaria 2025-09-28 20:37:23 -07:00
parent bb97f4b07a
commit 6cae8da29d
3 changed files with 16 additions and 17 deletions

View file

@ -127,8 +127,6 @@
''^tests/functional/local-overlay-store/bad-uris\.sh$''
''^tests/functional/local-overlay-store/build-inner\.sh$''
''^tests/functional/local-overlay-store/build\.sh$''
''^tests/functional/local-overlay-store/check-post-init-inner\.sh$''
''^tests/functional/local-overlay-store/check-post-init\.sh$''
''^tests/functional/logging\.sh$''
''^tests/functional/misc\.sh$''
''^tests/functional/multiple-outputs\.sh$''

View file

@ -19,41 +19,41 @@ mountOverlayfs
### Check status
# Checking for path in lower layer
stat $(toRealPath "$storeA/nix/store" "$pathInLowerStore")
stat "$(toRealPath "$storeA/nix/store" "$pathInLowerStore")"
# Checking for path in upper layer (should fail)
expect 1 stat $(toRealPath "$storeBTop" "$pathInLowerStore")
expect 1 stat "$(toRealPath "$storeBTop" "$pathInLowerStore")"
# Checking for path in overlay store matching lower layer
diff $(toRealPath "$storeA/nix/store" "$pathInLowerStore") $(toRealPath "$storeBRoot/nix/store" "$pathInLowerStore")
diff "$(toRealPath "$storeA/nix/store" "$pathInLowerStore")" "$(toRealPath "$storeBRoot/nix/store" "$pathInLowerStore")"
# Checking requisites query agreement
[[ \
$(nix-store --store $storeA --query --requisites $drvPath) \
$(nix-store --store "$storeA" --query --requisites "$drvPath") \
== \
$(nix-store --store $storeB --query --requisites $drvPath) \
$(nix-store --store "$storeB" --query --requisites "$drvPath") \
]]
# Checking referrers query agreement
busyboxStore=$(nix store --store $storeA add-path $busybox)
busyboxStore=$(nix store --store "$storeA" add-path "$busybox")
[[ \
$(nix-store --store $storeA --query --referrers $busyboxStore) \
$(nix-store --store "$storeA" --query --referrers "$busyboxStore") \
== \
$(nix-store --store $storeB --query --referrers $busyboxStore) \
$(nix-store --store "$storeB" --query --referrers "$busyboxStore") \
]]
# Checking derivers query agreement
[[ \
$(nix-store --store $storeA --query --deriver $pathInLowerStore) \
$(nix-store --store "$storeA" --query --deriver "$pathInLowerStore") \
== \
$(nix-store --store $storeB --query --deriver $pathInLowerStore) \
$(nix-store --store "$storeB" --query --deriver "$pathInLowerStore") \
]]
# Checking outputs query agreement
[[ \
$(nix-store --store $storeA --query --outputs $drvPath) \
$(nix-store --store "$storeA" --query --outputs "$drvPath") \
== \
$(nix-store --store $storeB --query --outputs $drvPath) \
$(nix-store --store "$storeB" --query --outputs "$drvPath") \
]]
# Verifying path in lower layer
@ -62,10 +62,10 @@ nix-store --verify-path --store "$storeA" "$pathInLowerStore"
# Verifying path in merged-store
nix-store --verify-path --store "$storeB" "$pathInLowerStore"
hashPart=$(echo $pathInLowerStore | sed "s^${NIX_STORE_DIR:-/nix/store}/^^" | sed 's/-.*//')
hashPart=$(echo "$pathInLowerStore" | sed "s^${NIX_STORE_DIR:-/nix/store}/^^" | sed 's/-.*//')
# Lower store can find from hash part
[[ $(nix store --store $storeA path-from-hash-part $hashPart) == $pathInLowerStore ]]
[[ $(nix store --store "$storeA" path-from-hash-part "$hashPart") == "$pathInLowerStore" ]]
# merged store can find from hash part
[[ $(nix store --store $storeB path-from-hash-part $hashPart) == $pathInLowerStore ]]
[[ $(nix store --store "$storeB" path-from-hash-part "$hashPart") == "$pathInLowerStore" ]]

View file

@ -1,3 +1,4 @@
# shellcheck shell=bash
source common.sh
source ../common/init.sh