nix-super/tests/functional/local-overlay-store/redundant-add-inner.sh

35 lines
650 B
Bash
Raw Normal View History

#!/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
setupStoreDirs
initLowerStore
mountOverlayfs
### Do a redundant add
# upper layer should not have it
path=$(nix-store --store "$storeA" ../dummy)
expect 1 stat $(toRealPath "$storeBTop/nix/store" "$path")
pathFromB=$(nix-store --store "$storeB" --add ../dummy)
[[ $path == $pathFromB ]]
# lower store should have it from before
stat $(toRealPath "$storeA/nix/store" "$path")
# upper layer should still not have it (no redundant copy)
expect 1 stat $(toRealPath "$storeBTop" "$path")