mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-07 18:57:19 +02:00
Testing overlayfs stores
This commit is contained in:
parent
4dcc0a1b76
commit
111aeb9e92
4 changed files with 57 additions and 2 deletions
|
@ -3,7 +3,7 @@ source common/vars-and-functions.sh
|
||||||
|
|
||||||
test -n "$TEST_ROOT"
|
test -n "$TEST_ROOT"
|
||||||
if test -d "$TEST_ROOT"; then
|
if test -d "$TEST_ROOT"; then
|
||||||
chmod -R u+w "$TEST_ROOT"
|
chmod -R u+rw "$TEST_ROOT"
|
||||||
# We would delete any daemon socket, so let's stop the daemon first.
|
# We would delete any daemon socket, so let's stop the daemon first.
|
||||||
killDaemon
|
killDaemon
|
||||||
rm -rf "$TEST_ROOT"
|
rm -rf "$TEST_ROOT"
|
||||||
|
|
|
@ -124,7 +124,8 @@ nix_tests = \
|
||||||
flakes/show.sh \
|
flakes/show.sh \
|
||||||
impure-derivations.sh \
|
impure-derivations.sh \
|
||||||
path-from-hash-part.sh \
|
path-from-hash-part.sh \
|
||||||
toString-path.sh
|
toString-path.sh \
|
||||||
|
overlay-local-store.sh
|
||||||
|
|
||||||
ifeq ($(HAVE_LIBCPUID), 1)
|
ifeq ($(HAVE_LIBCPUID), 1)
|
||||||
nix_tests += compute-levels.sh
|
nix_tests += compute-levels.sh
|
||||||
|
|
3
tests/overlay-local-store.sh
Normal file
3
tests/overlay-local-store.sh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
exec unshare --mount --map-root-user overlay-local-store/inner.sh
|
51
tests/overlay-local-store/inner.sh
Executable file
51
tests/overlay-local-store/inner.sh
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
export NIX_CONFIG='build-users-group = '
|
||||||
|
|
||||||
|
# Creating testing directories
|
||||||
|
|
||||||
|
storeA="$TEST_ROOT/store_a"
|
||||||
|
storeB="$TEST_ROOT/store_b?real=$TEST_ROOT/merged-store"
|
||||||
|
storeBTop="$TEST_ROOT/store_b"
|
||||||
|
|
||||||
|
mkdir -p "$TEST_ROOT"/{store_a,store_b,merged-store,workdir}
|
||||||
|
|
||||||
|
# Mounting Overlay Store
|
||||||
|
|
||||||
|
nix-store --store "$TEST_ROOT/store_a" --add dummy
|
||||||
|
nix-store --store "$TEST_ROOT/store_b" --add dummy
|
||||||
|
|
||||||
|
mount -t overlay overlay \
|
||||||
|
-o lowerdir="$TEST_ROOT/store_a/nix/store" \
|
||||||
|
-o upperdir="$TEST_ROOT/store_b/nix/store" \
|
||||||
|
-o workdir="$TEST_ROOT/workdir" \
|
||||||
|
"$TEST_ROOT/merged-store" || skipTest "overlayfs is not supported"
|
||||||
|
|
||||||
|
path_a=$(nix-build '<nixpkgs>' -A signal-desktop --store "$storeA")
|
||||||
|
|
||||||
|
# Checking for Path in store_a
|
||||||
|
stat "$TEST_ROOT/store_a/$path_a"
|
||||||
|
|
||||||
|
# Checking for Path in store_b
|
||||||
|
expect 1 stat "$TEST_ROOT/store_b/$path_a"
|
||||||
|
|
||||||
|
# Checking for Path in merged-store
|
||||||
|
ls "$TEST_ROOT/merged-store/$(echo "$path_a" | sed 's|/nix/store/||g')"
|
||||||
|
|
||||||
|
|
||||||
|
# Verifying path in store_a
|
||||||
|
nix-store --verify-path --store "$storeA" "$path_a"
|
||||||
|
|
||||||
|
# Verifiying path in merged-store (Should fail)
|
||||||
|
expect 1 nix-store --verify-path --store "$storeB" "$path_a"
|
||||||
|
|
||||||
|
# Verifying path in store_b (Should fail)
|
||||||
|
expect 1 nix-store --verify-path --store "$storeBTop" "$path_a"
|
||||||
|
|
||||||
|
path_b=$(nix-build '<nixpkgs>' -A signal-desktop --store "$storeB")
|
Loading…
Add table
Reference in a new issue