mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Test that delete works for duplicate file edge case.
This commit is contained in:
parent
d9688ba708
commit
cc6f8aa91a
3 changed files with 45 additions and 1 deletions
38
tests/overlay-local-store/delete-inner.sh
Normal file
38
tests/overlay-local-store/delete-inner.sh
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/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
|
||||
|
||||
storeDirs
|
||||
|
||||
initLowerStore
|
||||
|
||||
mountOverlayfs
|
||||
|
||||
# Add to overlay before lower to ensure file is duplicated
|
||||
upperPath=$(nix-store --store "$storeB" --add delete.sh)
|
||||
lowerPath=$(nix-store --store "$storeA" --add delete.sh)
|
||||
[[ "$upperPath" = "$lowerPath" ]]
|
||||
|
||||
# Check there really are two files with different inodes
|
||||
upperInode=$(stat -c %i "$storeBRoot/$upperPath")
|
||||
lowerInode=$(stat -c %i "$storeA/$lowerPath")
|
||||
[[ "$upperInode" != "$lowerInode" ]]
|
||||
|
||||
# Now delete file via the overlay store
|
||||
nix-store --store "$storeB" --delete "$upperPath"
|
||||
|
||||
# Check there is no longer a file in upper layer
|
||||
expect 1 stat "$storeBTop/${upperPath##/nix/store/}"
|
||||
|
||||
# Check that overlay file is now the one in lower layer
|
||||
upperInode=$(stat -c %i "$storeBRoot/$upperPath")
|
||||
lowerInode=$(stat -c %i "$storeA/$lowerPath")
|
||||
[[ "$upperInode" = "$lowerInode" ]]
|
5
tests/overlay-local-store/delete.sh
Normal file
5
tests/overlay-local-store/delete.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
source common.sh
|
||||
|
||||
requireEnvironment
|
||||
setupConfig
|
||||
execUnshare ./delete-inner.sh
|
|
@ -6,6 +6,7 @@ overlay-local-store-tests := \
|
|||
$(d)/add-lower.sh \
|
||||
$(d)/gc.sh \
|
||||
$(d)/verify.sh \
|
||||
$(d)/optimise.sh
|
||||
$(d)/optimise.sh \
|
||||
$(d)/delete.sh
|
||||
|
||||
install-tests-groups += overlay-local-store
|
||||
|
|
Loading…
Reference in a new issue