mirror of
https://github.com/NixOS/nix
synced 2025-07-10 08:53:55 +02:00
Ensure all overlay tests use new tmpfs store paths.
This commit is contained in:
parent
7fda19e2f1
commit
9769a0ae7d
5 changed files with 25 additions and 19 deletions
|
@ -12,30 +12,36 @@ setupConfig () {
|
|||
echo "build-users-group = " >> "$NIX_CONF_DIR"/nix.conf
|
||||
}
|
||||
|
||||
|
||||
|
||||
storeDirs () {
|
||||
storesRoot="$TEST_ROOT/stores"
|
||||
mkdir -p "$storesRoot"
|
||||
mount -t tmpfs tmpfs "$storesRoot"
|
||||
storeA="$storesRoot/store-a"
|
||||
storeBTop="$storesRoot/store-b"
|
||||
storeB="local-overlay?root=$storesRoot/merged-store&lower-store=$storeA&upper-layer=$storeBTop"
|
||||
# Attempt to create store dirs on tmpfs volume.
|
||||
# This ensures lowerdir, upperdir and workdir will be on
|
||||
# a consistent filesystem that fully supports OverlayFS.
|
||||
storeVolume="$TEST_ROOT/stores"
|
||||
mkdir -p "$storeVolume"
|
||||
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
|
||||
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
|
||||
mountOverlayfs () {
|
||||
mergedStorePath="$storesRoot/merged-store/nix/store"
|
||||
mergedStorePath="$storeVolume/merged-store/nix/store"
|
||||
mount -t overlay overlay \
|
||||
-o lowerdir="$storeA/nix/store" \
|
||||
-o upperdir="$storeBTop" \
|
||||
-o workdir="$storesRoot/workdir" \
|
||||
-o workdir="$storeVolume/workdir" \
|
||||
"$mergedStorePath" \
|
||||
|| skipTest "overlayfs is not supported"
|
||||
|
||||
cleanupOverlay () {
|
||||
umount "$storesRoot/merged-store/nix/store"
|
||||
rm -r $storesRoot/workdir
|
||||
umount "$storeVolume/merged-store/nix/store"
|
||||
rm -r $storeVolume/workdir
|
||||
}
|
||||
trap cleanupOverlay EXIT
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue