mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 14:52:55 +00:00
Ensure all overlay tests use new tmpfs store paths.
This commit is contained in:
parent
7fda19e2f1
commit
9769a0ae7d
@ -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 "$TEST_ROOT/merged-store/$overlayPath"
|
stat "$storeVolume/merged-store/$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 "$TEST_ROOT/store-a/$lowerPath"
|
stat "$storeVolume/store-a/$lowerPath"
|
||||||
|
|
||||||
# Remount overlayfs to ensure synchronization
|
# Remount overlayfs to ensure synchronization
|
||||||
mount -o remount "$TEST_ROOT/merged-store/nix/store"
|
mount -o remount "$storeVolume/merged-store/nix/store"
|
||||||
|
|
||||||
# Path should be accessible via overlay store
|
# Path should be accessible via overlay store
|
||||||
stat "$TEST_ROOT/merged-store/$lowerPath"
|
stat "$storeVolume/merged-store/$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=$TEST_ROOT/merged-store&lower-store=$badTestRoot&upper-layer=$storeBTop"
|
storeBadLower="local-overlay?root=$storeVolume/merged-store&lower-store=$badTestRoot&upper-layer=$storeBTop"
|
||||||
storeBadUpper="local-overlay?root=$TEST_ROOT/merged-store&lower-store=$storeA&upper-layer=$badTestRoot"
|
storeBadUpper="local-overlay?root=$storeVolume/merged-store&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 "$TEST_ROOT/merged-store/nix/store" "$path")
|
diff $(toRealPath "$storeA/nix/store" "$path") $(toRealPath "$storeVolume/merged-store/nix/store" "$path")
|
||||||
|
|
||||||
# Checking requisites query agreement
|
# Checking requisites query agreement
|
||||||
[[ \
|
[[ \
|
||||||
|
@ -12,30 +12,36 @@ setupConfig () {
|
|||||||
echo "build-users-group = " >> "$NIX_CONF_DIR"/nix.conf
|
echo "build-users-group = " >> "$NIX_CONF_DIR"/nix.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
storeDirs () {
|
storeDirs () {
|
||||||
storesRoot="$TEST_ROOT/stores"
|
# Attempt to create store dirs on tmpfs volume.
|
||||||
mkdir -p "$storesRoot"
|
# This ensures lowerdir, upperdir and workdir will be on
|
||||||
mount -t tmpfs tmpfs "$storesRoot"
|
# a consistent filesystem that fully supports OverlayFS.
|
||||||
storeA="$storesRoot/store-a"
|
storeVolume="$TEST_ROOT/stores"
|
||||||
storeBTop="$storesRoot/store-b"
|
mkdir -p "$storeVolume"
|
||||||
storeB="local-overlay?root=$storesRoot/merged-store&lower-store=$storeA&upper-layer=$storeBTop"
|
mount -t tmpfs tmpfs "$storeVolume" || true # But continue anyway if that fails.
|
||||||
|
|
||||||
|
storeA="$storeVolume/store-a"
|
||||||
|
storeBTop="$storeVolume/store-b"
|
||||||
|
storeB="local-overlay?root=$storeVolume/merged-store&lower-store=$storeA&upper-layer=$storeBTop"
|
||||||
# Creating testing directories
|
# Creating testing directories
|
||||||
mkdir -p "$storesRoot"/{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="$storesRoot/merged-store/nix/store"
|
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="$storesRoot/workdir" \
|
-o workdir="$storeVolume/workdir" \
|
||||||
"$mergedStorePath" \
|
"$mergedStorePath" \
|
||||||
|| skipTest "overlayfs is not supported"
|
|| skipTest "overlayfs is not supported"
|
||||||
|
|
||||||
cleanupOverlay () {
|
cleanupOverlay () {
|
||||||
umount "$storesRoot/merged-store/nix/store"
|
umount "$storeVolume/merged-store/nix/store"
|
||||||
rm -r $storesRoot/workdir
|
rm -r $storeVolume/workdir
|
||||||
}
|
}
|
||||||
trap cleanupOverlay EXIT
|
trap cleanupOverlay EXIT
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ initLowerStore
|
|||||||
mountOverlayfs
|
mountOverlayfs
|
||||||
|
|
||||||
# Create a file to add to store
|
# Create a file to add to store
|
||||||
dupFilePath="$storesRoot/dup-file"
|
dupFilePath="$TEST_ROOT/dup-file"
|
||||||
echo Duplicate > "$dupFilePath"
|
echo Duplicate > "$dupFilePath"
|
||||||
|
|
||||||
# Add it to the overlay store (it will be written to the upper layer)
|
# Add it to the overlay store (it will be written to the upper layer)
|
||||||
|
Loading…
Reference in New Issue
Block a user