mirror of
https://github.com/NixOS/nix
synced 2025-07-04 11:21:47 +02:00
Define storeBRoot variable distinct from storeB URI.
This commit is contained in:
parent
878c84d5ee
commit
2c66a093e0
5 changed files with 13 additions and 14 deletions
|
@ -18,14 +18,14 @@ mountOverlayfs
|
||||||
|
|
||||||
# Add something to the overlay store
|
# Add something to the overlay store
|
||||||
overlayPath=$(addTextToStore "$storeB" "overlay-file" "Add to overlay store")
|
overlayPath=$(addTextToStore "$storeB" "overlay-file" "Add to overlay store")
|
||||||
stat "$storeVolume/merged-store/$overlayPath"
|
stat "$storeBRoot/$overlayPath"
|
||||||
|
|
||||||
# Now add something to the lower store
|
# Now add something to the lower store
|
||||||
lowerPath=$(addTextToStore "$storeA" "lower-file" "Add to lower store")
|
lowerPath=$(addTextToStore "$storeA" "lower-file" "Add to lower store")
|
||||||
stat "$storeVolume/store-a/$lowerPath"
|
stat "$storeVolume/store-a/$lowerPath"
|
||||||
|
|
||||||
# Remount overlayfs to ensure synchronization
|
# Remount overlayfs to ensure synchronization
|
||||||
mount -o remount "$storeVolume/merged-store/nix/store"
|
remountOverlayfs
|
||||||
|
|
||||||
# Path should be accessible via overlay store
|
# Path should be accessible via overlay store
|
||||||
stat "$storeVolume/merged-store/$lowerPath"
|
stat "$storeBRoot/$lowerPath"
|
||||||
|
|
|
@ -7,8 +7,8 @@ storeDirs
|
||||||
mkdir -p $TEST_ROOT/bad_test
|
mkdir -p $TEST_ROOT/bad_test
|
||||||
badTestRoot=$TEST_ROOT/bad_test
|
badTestRoot=$TEST_ROOT/bad_test
|
||||||
storeBadRoot="local-overlay?root=$badTestRoot&lower-store=$storeA&upper-layer=$storeBTop"
|
storeBadRoot="local-overlay?root=$badTestRoot&lower-store=$storeA&upper-layer=$storeBTop"
|
||||||
storeBadLower="local-overlay?root=$storeVolume/merged-store&lower-store=$badTestRoot&upper-layer=$storeBTop"
|
storeBadLower="local-overlay?root=$storeBRoot&lower-store=$badTestRoot&upper-layer=$storeBTop"
|
||||||
storeBadUpper="local-overlay?root=$storeVolume/merged-store&lower-store=$storeA&upper-layer=$badTestRoot"
|
storeBadUpper="local-overlay?root=$storeBRoot&lower-store=$storeA&upper-layer=$badTestRoot"
|
||||||
|
|
||||||
declare -a storesBad=(
|
declare -a storesBad=(
|
||||||
"$storeBadRoot" "$storeBadLower" "$storeBadUpper"
|
"$storeBadRoot" "$storeBadLower" "$storeBadUpper"
|
||||||
|
|
|
@ -25,7 +25,7 @@ stat $(toRealPath "$storeA/nix/store" "$path")
|
||||||
expect 1 stat $(toRealPath "$storeBTop" "$path")
|
expect 1 stat $(toRealPath "$storeBTop" "$path")
|
||||||
|
|
||||||
# Checking for path in overlay store matching lower layer
|
# Checking for path in overlay store matching lower layer
|
||||||
diff $(toRealPath "$storeA/nix/store" "$path") $(toRealPath "$storeVolume/merged-store/nix/store" "$path")
|
diff $(toRealPath "$storeA/nix/store" "$path") $(toRealPath "$storeBRoot/nix/store" "$path")
|
||||||
|
|
||||||
# Checking requisites query agreement
|
# Checking requisites query agreement
|
||||||
[[ \
|
[[ \
|
||||||
|
|
|
@ -24,30 +24,30 @@ storeDirs () {
|
||||||
|
|
||||||
storeA="$storeVolume/store-a"
|
storeA="$storeVolume/store-a"
|
||||||
storeBTop="$storeVolume/store-b"
|
storeBTop="$storeVolume/store-b"
|
||||||
storeB="local-overlay?root=$storeVolume/merged-store&lower-store=$storeA&upper-layer=$storeBTop"
|
storeBRoot="$storeVolume/merged-store"
|
||||||
|
storeB="local-overlay?root=$storeBRoot&lower-store=$storeA&upper-layer=$storeBTop"
|
||||||
# Creating testing directories
|
# Creating testing directories
|
||||||
mkdir -p "$storeVolume"/{store-a/nix/store,store-b,merged-store/nix/store,workdir}
|
mkdir -p "$storeVolume"/{store-a/nix/store,store-b,merged-store/nix/store,workdir}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Mounting Overlay Store
|
# Mounting Overlay Store
|
||||||
mountOverlayfs () {
|
mountOverlayfs () {
|
||||||
mergedStorePath="$storeVolume/merged-store/nix/store"
|
|
||||||
mount -t overlay overlay \
|
mount -t overlay overlay \
|
||||||
-o lowerdir="$storeA/nix/store" \
|
-o lowerdir="$storeA/nix/store" \
|
||||||
-o upperdir="$storeBTop" \
|
-o upperdir="$storeBTop" \
|
||||||
-o workdir="$storeVolume/workdir" \
|
-o workdir="$storeVolume/workdir" \
|
||||||
"$mergedStorePath" \
|
"$storeBRoot/nix/store" \
|
||||||
|| skipTest "overlayfs is not supported"
|
|| skipTest "overlayfs is not supported"
|
||||||
|
|
||||||
cleanupOverlay () {
|
cleanupOverlay () {
|
||||||
umount "$storeVolume/merged-store/nix/store"
|
umount "$storeBRoot/nix/store"
|
||||||
rm -r $storeVolume/workdir
|
rm -r $storeVolume/workdir
|
||||||
}
|
}
|
||||||
trap cleanupOverlay EXIT
|
trap cleanupOverlay EXIT
|
||||||
}
|
}
|
||||||
|
|
||||||
remountOverlayfs () {
|
remountOverlayfs () {
|
||||||
mount -o remount "$mergedStorePath"
|
mount -o remount "$storeBRoot/nix/store"
|
||||||
}
|
}
|
||||||
|
|
||||||
toRealPath () {
|
toRealPath () {
|
||||||
|
|
|
@ -7,7 +7,7 @@ set -x
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
# Avoid store dir being inside sandbox build-dir
|
# Avoid store dir being inside sandbox build-dir
|
||||||
unset NIX_STORE_DIR # TODO: This causes toRealPath to fail (it expects this var to be set)
|
unset NIX_STORE_DIR
|
||||||
unset NIX_STATE_DIR
|
unset NIX_STATE_DIR
|
||||||
|
|
||||||
storeDirs
|
storeDirs
|
||||||
|
@ -27,5 +27,4 @@ path=$(nix-store --store "$storeB" --add ../dummy)
|
||||||
stat $(toRealPath "$storeA/nix/store" "$path")
|
stat $(toRealPath "$storeA/nix/store" "$path")
|
||||||
|
|
||||||
# upper layer should still not have it (no redundant copy)
|
# upper layer should still not have it (no redundant copy)
|
||||||
expect 1 stat $(toRealPath "$storeB/nix/store" "$path") # TODO: Check this is failing for the right reason.
|
expect 1 stat $(toRealPath "$storeBTop" "$path")
|
||||||
# $storeB is a store URI not a directory path
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue