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

36 lines
785 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
2023-12-11 18:36:53 +00:00
# (Already done in `initLowerStore`, but repeated here for clarity.)
pathInLowerStore=$(nix-store --store "$storeA" --add ../dummy)
2023-12-11 18:36:53 +00:00
# upper layer should not have it
expect 1 stat $(toRealPath "$storeBTop/nix/store" "$pathInLowerStore")
pathFromB=$(nix-store --store "$storeB" --add ../dummy)
[[ $pathInLowerStore == $pathFromB ]]
# lower store should have it from before
stat $(toRealPath "$storeA/nix/store" "$pathInLowerStore")
# upper layer should still not have it (no redundant copy)
expect 1 stat $(toRealPath "$storeBTop" "$pathInLowerStore")