From 2c66a093e05bc466d00c9365bc43567fd9d5c334 Mon Sep 17 00:00:00 2001 From: Ben Radford Date: Thu, 20 Jul 2023 11:03:14 +0100 Subject: [PATCH] Define storeBRoot variable distinct from storeB URI. --- tests/overlay-local-store/add-lower-inner.sh | 6 +++--- tests/overlay-local-store/bad-uris.sh | 4 ++-- tests/overlay-local-store/check-post-init-inner.sh | 2 +- tests/overlay-local-store/common.sh | 10 +++++----- tests/overlay-local-store/redundant-add-inner.sh | 5 ++--- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/overlay-local-store/add-lower-inner.sh b/tests/overlay-local-store/add-lower-inner.sh index 8c71f0780..ca7db7ab6 100755 --- a/tests/overlay-local-store/add-lower-inner.sh +++ b/tests/overlay-local-store/add-lower-inner.sh @@ -18,14 +18,14 @@ mountOverlayfs # Add something to the overlay store overlayPath=$(addTextToStore "$storeB" "overlay-file" "Add to overlay store") -stat "$storeVolume/merged-store/$overlayPath" +stat "$storeBRoot/$overlayPath" # Now add something to the lower store lowerPath=$(addTextToStore "$storeA" "lower-file" "Add to lower store") stat "$storeVolume/store-a/$lowerPath" # Remount overlayfs to ensure synchronization -mount -o remount "$storeVolume/merged-store/nix/store" +remountOverlayfs # Path should be accessible via overlay store -stat "$storeVolume/merged-store/$lowerPath" +stat "$storeBRoot/$lowerPath" diff --git a/tests/overlay-local-store/bad-uris.sh b/tests/overlay-local-store/bad-uris.sh index c59264735..462bf27eb 100644 --- a/tests/overlay-local-store/bad-uris.sh +++ b/tests/overlay-local-store/bad-uris.sh @@ -7,8 +7,8 @@ storeDirs mkdir -p $TEST_ROOT/bad_test badTestRoot=$TEST_ROOT/bad_test storeBadRoot="local-overlay?root=$badTestRoot&lower-store=$storeA&upper-layer=$storeBTop" -storeBadLower="local-overlay?root=$storeVolume/merged-store&lower-store=$badTestRoot&upper-layer=$storeBTop" -storeBadUpper="local-overlay?root=$storeVolume/merged-store&lower-store=$storeA&upper-layer=$badTestRoot" +storeBadLower="local-overlay?root=$storeBRoot&lower-store=$badTestRoot&upper-layer=$storeBTop" +storeBadUpper="local-overlay?root=$storeBRoot&lower-store=$storeA&upper-layer=$badTestRoot" declare -a storesBad=( "$storeBadRoot" "$storeBadLower" "$storeBadUpper" diff --git a/tests/overlay-local-store/check-post-init-inner.sh b/tests/overlay-local-store/check-post-init-inner.sh index 2e7db2adc..0f4654cc2 100755 --- a/tests/overlay-local-store/check-post-init-inner.sh +++ b/tests/overlay-local-store/check-post-init-inner.sh @@ -25,7 +25,7 @@ stat $(toRealPath "$storeA/nix/store" "$path") expect 1 stat $(toRealPath "$storeBTop" "$path") # Checking for path in overlay store matching lower layer -diff $(toRealPath "$storeA/nix/store" "$path") $(toRealPath "$storeVolume/merged-store/nix/store" "$path") +diff $(toRealPath "$storeA/nix/store" "$path") $(toRealPath "$storeBRoot/nix/store" "$path") # Checking requisites query agreement [[ \ diff --git a/tests/overlay-local-store/common.sh b/tests/overlay-local-store/common.sh index ac4a59cd8..2b23352ab 100644 --- a/tests/overlay-local-store/common.sh +++ b/tests/overlay-local-store/common.sh @@ -24,30 +24,30 @@ storeDirs () { storeA="$storeVolume/store-a" storeBTop="$storeVolume/store-b" - storeB="local-overlay?root=$storeVolume/merged-store&lower-store=$storeA&upper-layer=$storeBTop" + storeBRoot="$storeVolume/merged-store" + storeB="local-overlay?root=$storeBRoot&lower-store=$storeA&upper-layer=$storeBTop" # Creating testing directories mkdir -p "$storeVolume"/{store-a/nix/store,store-b,merged-store/nix/store,workdir} } # Mounting Overlay Store mountOverlayfs () { - mergedStorePath="$storeVolume/merged-store/nix/store" mount -t overlay overlay \ -o lowerdir="$storeA/nix/store" \ -o upperdir="$storeBTop" \ -o workdir="$storeVolume/workdir" \ - "$mergedStorePath" \ + "$storeBRoot/nix/store" \ || skipTest "overlayfs is not supported" cleanupOverlay () { - umount "$storeVolume/merged-store/nix/store" + umount "$storeBRoot/nix/store" rm -r $storeVolume/workdir } trap cleanupOverlay EXIT } remountOverlayfs () { - mount -o remount "$mergedStorePath" + mount -o remount "$storeBRoot/nix/store" } toRealPath () { diff --git a/tests/overlay-local-store/redundant-add-inner.sh b/tests/overlay-local-store/redundant-add-inner.sh index cfdae68b4..34b841e38 100755 --- a/tests/overlay-local-store/redundant-add-inner.sh +++ b/tests/overlay-local-store/redundant-add-inner.sh @@ -7,7 +7,7 @@ set -x source common.sh # Avoid store dir being inside sandbox build-dir -unset NIX_STORE_DIR # TODO: This causes toRealPath to fail (it expects this var to be set) +unset NIX_STORE_DIR unset NIX_STATE_DIR storeDirs @@ -27,5 +27,4 @@ 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") # TODO: Check this is failing for the right reason. - # $storeB is a store URI not a directory path +expect 1 stat $(toRealPath "$storeBTop" "$path")