1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 19:23:54 +02:00

Implement test for store path deduplication.

This commit is contained in:
Ben Radford 2023-07-19 11:23:54 +01:00
parent 614efc1240
commit a9510f9502
No known key found for this signature in database
GPG key ID: 9DF5D4640AB888D5
2 changed files with 39 additions and 10 deletions

View file

@ -22,11 +22,12 @@ storeDirs () {
# Mounting Overlay Store
mountOverlayfs () {
mergedStorePath="$TEST_ROOT/merged-store/nix/store"
mount -t overlay overlay \
-o lowerdir="$storeA/nix/store" \
-o upperdir="$storeBTop" \
-o workdir="$TEST_ROOT/workdir" \
"$TEST_ROOT/merged-store/nix/store" \
"$mergedStorePath" \
|| skipTest "overlayfs is not supported"
cleanupOverlay () {
@ -36,6 +37,10 @@ mountOverlayfs () {
trap cleanupOverlay EXIT
}
remountOverlayfs () {
mount -o remount "$mergedStorePath"
}
toRealPath () {
storeDir=$1; shift
storePath=$1; shift
@ -54,12 +59,3 @@ initLowerStore () {
execUnshare () {
exec unshare --mount --map-root-user "$@"
}
addTextToStore() {
storeDir=$1; shift
filename=$1; shift
content=$1; shift
filePath="$TEST_HOME/$filename"
echo "$content" > "$filePath"
nix-store --store "$storeDir" --add "$filePath"
}