mirror of
https://github.com/NixOS/nix
synced 2025-07-08 02:43:54 +02:00
Begin to split up overlay-local-store tests
The bad-uris tests are now in their own file. "Outer" is a bad name, but it will be split up next.
This commit is contained in:
parent
b7e5aaf90d
commit
0979a374c5
7 changed files with 90 additions and 64 deletions
52
tests/overlay-local-store/common.sh
Normal file
52
tests/overlay-local-store/common.sh
Normal file
|
@ -0,0 +1,52 @@
|
|||
source ../common.sh
|
||||
|
||||
requireEnvironment () {
|
||||
requireSandboxSupport
|
||||
[[ $busybox =~ busybox ]] || skipTest "no busybox"
|
||||
if [[ $(uname) != Linux ]]; then skipTest "Need Linux for overlayfs"; fi
|
||||
needLocalStore "The test uses --store always so we would just be bypassing the daemon"
|
||||
}
|
||||
|
||||
setupConfig () {
|
||||
echo "drop-supplementary-groups = false" >> "$NIX_CONF_DIR"/nix.conf
|
||||
echo "build-users-group = " >> "$NIX_CONF_DIR"/nix.conf
|
||||
}
|
||||
|
||||
storeDirs () {
|
||||
storeA="$TEST_ROOT/store-a"
|
||||
storeBTop="$TEST_ROOT/store-b"
|
||||
storeB="local-overlay?root=$TEST_ROOT/merged-store&lower-store=$storeA&upper-layer=$storeBTop"
|
||||
# Creating testing directories
|
||||
mkdir -p "$TEST_ROOT"/{store-a/nix/store,store-b,merged-store/nix/store,workdir}
|
||||
}
|
||||
|
||||
# Mounting Overlay Store
|
||||
mountOverlayfs () {
|
||||
mount -t overlay overlay \
|
||||
-o lowerdir="$storeA/nix/store" \
|
||||
-o upperdir="$storeBTop" \
|
||||
-o workdir="$TEST_ROOT/workdir" \
|
||||
"$TEST_ROOT/merged-store/nix/store" \
|
||||
|| skipTest "overlayfs is not supported"
|
||||
|
||||
cleanupOverlay () {
|
||||
umount "$TEST_ROOT/merged-store/nix/store"
|
||||
rm -r $TEST_ROOT/workdir
|
||||
}
|
||||
trap cleanupOverlay EXIT
|
||||
}
|
||||
|
||||
toRealPath () {
|
||||
storeDir=$1; shift
|
||||
storePath=$1; shift
|
||||
echo $storeDir$(echo $storePath | sed "s^$NIX_STORE_DIR^^")
|
||||
}
|
||||
|
||||
initLowerStore () {
|
||||
# Init lower store with some stuff
|
||||
nix-store --store "$storeA" --add ../dummy
|
||||
|
||||
# Build something in lower store
|
||||
drvPath=$(nix-instantiate --store $storeA ../hermetic.nix --arg busybox "$busybox" --arg seed 1)
|
||||
path=$(nix-store --store "$storeA" --realise $drvPath)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue