mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 14:52:55 +00:00
Paths added to lower store are accessible via overlay.
This commit is contained in:
parent
f66b65a30a
commit
a33ee5c843
31
tests/overlay-local-store/add-lower-inner.sh
Executable file
31
tests/overlay-local-store/add-lower-inner.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
set -x
|
||||
|
||||
source common.sh
|
||||
|
||||
# Avoid store dir being inside sandbox build-dir
|
||||
unset NIX_STORE_DIR
|
||||
unset NIX_STATE_DIR
|
||||
|
||||
storeDirs
|
||||
|
||||
initLowerStore
|
||||
|
||||
mountOverlayfs
|
||||
|
||||
# Add something to the overlay store
|
||||
overlayPath=$(addTextToStore "$storeB" "overlay-file" "Add to overlay store")
|
||||
stat "$TEST_ROOT/merged-store/$overlayPath"
|
||||
|
||||
# Now add something to the lower store
|
||||
lowerPath=$(addTextToStore "$storeA" "lower-file" "Add to lower store")
|
||||
stat "$TEST_ROOT/store-a/$lowerPath"
|
||||
|
||||
# Remount overlayfs to ensure synchronization
|
||||
mount -o remount "$TEST_ROOT/merged-store/nix/store"
|
||||
|
||||
# Path should be accessible via overlay store
|
||||
stat "$TEST_ROOT/merged-store/$lowerPath"
|
5
tests/overlay-local-store/add-lower.sh
Executable file
5
tests/overlay-local-store/add-lower.sh
Executable file
@ -0,0 +1,5 @@
|
||||
source common.sh
|
||||
|
||||
requireEnvironment
|
||||
setupConfig
|
||||
execUnshare ./add-lower-inner.sh
|
@ -8,7 +8,7 @@ requireEnvironment () {
|
||||
}
|
||||
|
||||
setupConfig () {
|
||||
echo "drop-supplementary-groups = false" >> "$NIX_CONF_DIR"/nix.conf
|
||||
echo "require-drop-supplementary-groups = false" >> "$NIX_CONF_DIR"/nix.conf
|
||||
echo "build-users-group = " >> "$NIX_CONF_DIR"/nix.conf
|
||||
}
|
||||
|
||||
@ -54,3 +54,12 @@ 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"
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ overlay-local-store-tests := \
|
||||
$(d)/check-post-init.sh \
|
||||
$(d)/redundant-add.sh \
|
||||
$(d)/build.sh \
|
||||
$(d)/bad-uris.sh
|
||||
$(d)/bad-uris.sh \
|
||||
$(d)/add-lower.sh
|
||||
|
||||
install-tests-groups += overlay-local-store
|
||||
|
@ -7,7 +7,7 @@ set -x
|
||||
source common.sh
|
||||
|
||||
# Avoid store dir being inside sandbox build-dir
|
||||
unset NIX_STORE_DIR
|
||||
unset NIX_STORE_DIR # TODO: This causes toRealPath to fail (it expects this var to be set)
|
||||
unset NIX_STATE_DIR
|
||||
|
||||
storeDirs
|
||||
@ -27,4 +27,5 @@ path=$(nix-store --store "$storeB" --add ../dummy)
|
||||
stat $(toRealPath "$storeA/nix/store" "$path")
|
||||
|
||||
# upper layer should still not have it (no redundant copy)
|
||||
expect 1 stat $(toRealPath "$storeB/nix/store" "$path")
|
||||
expect 1 stat $(toRealPath "$storeB/nix/store" "$path") # TODO: Check this is failing for the right reason.
|
||||
# $storeB is a store URI not a directory path
|
||||
|
Loading…
Reference in New Issue
Block a user