mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Test that remounting fixes 'stale file handle' errors.
This commit is contained in:
parent
8225b7a011
commit
19164cf727
3 changed files with 54 additions and 1 deletions
|
@ -8,6 +8,7 @@ overlay-local-store-tests := \
|
|||
$(d)/delete-duplicate.sh \
|
||||
$(d)/gc.sh \
|
||||
$(d)/verify.sh \
|
||||
$(d)/optimise.sh
|
||||
$(d)/optimise.sh \
|
||||
$(d)/stale-file-handle.sh
|
||||
|
||||
install-tests-groups += overlay-local-store
|
||||
|
|
47
tests/overlay-local-store/stale-file-handle-inner.sh
Executable file
47
tests/overlay-local-store/stale-file-handle-inner.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/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
|
||||
|
||||
buildInStore () {
|
||||
nix-build --store "$1" ../hermetic.nix --arg busybox "$busybox" --arg seed 1 --no-out-link
|
||||
}
|
||||
|
||||
triggerStaleFileHandle () {
|
||||
# Arrange it so there are duplicate paths
|
||||
nix-store --store "$storeA" --gc # Clear lower store
|
||||
buildInStore "$storeB" # Build into upper layer first
|
||||
buildInStore "$storeA" # Then build in lower store
|
||||
|
||||
# Duplicate paths mean GC will have to delete via upper layer
|
||||
nix-store --store "$storeB" --gc
|
||||
|
||||
# Clear lower store again to force building in upper layer
|
||||
nix-store --store "$storeA" --gc
|
||||
|
||||
# Now attempting to build in upper layer will fail
|
||||
buildInStore "$storeB"
|
||||
}
|
||||
|
||||
# Without remounting, we should encounter errors
|
||||
expectStderr 1 triggerStaleFileHandle | grepQuiet 'Stale file handle'
|
||||
|
||||
# Configure remount-hook and reset OverlayFS
|
||||
storeB="$storeB&remount-hook=$PWD/remount.sh"
|
||||
remountOverlayfs
|
||||
|
||||
# Now it should succeed
|
||||
triggerStaleFileHandle
|
5
tests/overlay-local-store/stale-file-handle.sh
Executable file
5
tests/overlay-local-store/stale-file-handle.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
source common.sh
|
||||
|
||||
requireEnvironment
|
||||
setupConfig
|
||||
execUnshare ./stale-file-handle-inner.sh
|
Loading…
Reference in a new issue