mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-01-19 17:46:46 +02:00
Write test for deleting objects referenced from below
Currently fails, as expected.
This commit is contained in:
parent
a1a7f3156d
commit
19c43c5d78
4 changed files with 47 additions and 2 deletions
|
@ -37,7 +37,7 @@ let
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
echo hi-input3
|
echo hi-input3
|
||||||
read x < ${input2}
|
read x < ${input2}
|
||||||
echo $x BAZ > $out
|
echo ${input2} $x BAZ > $out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,6 +51,6 @@ in
|
||||||
''
|
''
|
||||||
read x < ${input1}
|
read x < ${input1}
|
||||||
read y < ${input3}
|
read y < ${input3}
|
||||||
echo "$x $y" > $out
|
echo ${input1} ${input3} "$x $y" > $out
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
39
tests/overlay-local-store/delete-inner.sh
Normal file
39
tests/overlay-local-store/delete-inner.sh
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
# Avoid store dir being inside sandbox build-dir
|
||||||
|
unset NIX_STORE_DIR
|
||||||
|
unset NIX_STATE_DIR
|
||||||
|
|
||||||
|
storeDirs
|
||||||
|
|
||||||
|
initLowerStore
|
||||||
|
|
||||||
|
mountOverlayfs
|
||||||
|
|
||||||
|
export NIX_REMOTE="$storeB"
|
||||||
|
stateB="$storeBRoot/nix/var/nix"
|
||||||
|
hermetic=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg seed 2)
|
||||||
|
input1=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg seed 2 -A passthru.input1 -j0)
|
||||||
|
input2=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg seed 2 -A passthru.input2 -j0)
|
||||||
|
input3=$(nix-build ../hermetic.nix --no-out-link --arg busybox "$busybox" --arg seed 2 -A passthru.input3 -j0)
|
||||||
|
|
||||||
|
# Can't delete because referenced
|
||||||
|
expectStderr 1 nix-store --delete $input1 | grepQuiet "Cannot delete path"
|
||||||
|
expectStderr 1 nix-store --delete $input2 | grepQuiet "Cannot delete path"
|
||||||
|
expectStderr 1 nix-store --delete $input3 | grepQuiet "Cannot delete path"
|
||||||
|
|
||||||
|
# These same paths are referenced in the lower layer (by the seed 1
|
||||||
|
# build done in `initLowerStore`).
|
||||||
|
expectStderr 1 nix-store --store "$storeA" --delete $input2 | grepQuiet "Cannot delete path"
|
||||||
|
expectStderr 1 nix-store --store "$storeA" --delete $input3 | grepQuiet "Cannot delete path"
|
||||||
|
|
||||||
|
# Can delete
|
||||||
|
nix-store --delete $hermetic
|
||||||
|
|
||||||
|
# Now unreferenced in upper layer, can delete
|
||||||
|
nix-store --delete $input3
|
||||||
|
nix-store --delete $input2
|
5
tests/overlay-local-store/delete.sh
Executable file
5
tests/overlay-local-store/delete.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
requireEnvironment
|
||||||
|
setupConfig
|
||||||
|
execUnshare ./delete-inner.sh
|
|
@ -4,6 +4,7 @@ overlay-local-store-tests := \
|
||||||
$(d)/build.sh \
|
$(d)/build.sh \
|
||||||
$(d)/bad-uris.sh \
|
$(d)/bad-uris.sh \
|
||||||
$(d)/add-lower.sh \
|
$(d)/add-lower.sh \
|
||||||
|
$(d)/delete.sh \
|
||||||
$(d)/gc.sh \
|
$(d)/gc.sh \
|
||||||
$(d)/verify.sh \
|
$(d)/verify.sh \
|
||||||
$(d)/optimise.sh
|
$(d)/optimise.sh
|
||||||
|
|
Loading…
Reference in a new issue