mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 14:52:55 +00:00
Add another case to the nix-collect-garbage -d
test
This commit is contained in:
parent
37bffbc28f
commit
ca5752d4fa
21
tests/gc.sh
21
tests/gc.sh
@ -56,25 +56,34 @@ testCollectGarbageD () {
|
||||
clearProfiles
|
||||
# Run two `nix-env` commands, should create two generations of
|
||||
# the profile
|
||||
nix-env -f ./user-envs.nix -i foo-1.0
|
||||
nix-env -f ./user-envs.nix -i foo-2.0pre1
|
||||
[[ $(nix-env --list-generations | wc -l) -eq 2 ]]
|
||||
nix-env -f ./user-envs.nix -i foo-1.0 "$@"
|
||||
nix-env -f ./user-envs.nix -i foo-2.0pre1 "$@"
|
||||
[[ $(nix-env --list-generations "$@" | wc -l) -eq 2 ]]
|
||||
|
||||
# Clear the profile history. There should be only one generation
|
||||
# left
|
||||
nix-collect-garbage -d
|
||||
[[ $(nix-env --list-generations | wc -l) -eq 1 ]]
|
||||
[[ $(nix-env --list-generations "$@" | wc -l) -eq 1 ]]
|
||||
}
|
||||
|
||||
# `nix-env` doesn't work with CA derivations, so let's ignore that bit if we're
|
||||
# using them
|
||||
if [[ -z "${NIX_TESTS_CA_BY_DEFAULT:-}" ]]; then
|
||||
testCollectGarbageD
|
||||
|
||||
# Run the same test, but forcing the profiles an arbitrary location.
|
||||
rm ~/.nix-profile
|
||||
ln -s $TEST_ROOT/blah ~/.nix-profile
|
||||
testCollectGarbageD
|
||||
|
||||
# Run the same test, but forcing the profiles at their legacy location under
|
||||
# /nix/var/nix.
|
||||
#
|
||||
# Note that we *don't* use the default profile; `nix-collect-garbage` will
|
||||
# need to check the legacy conditional unconditionally not just follow
|
||||
# `~/.nix-profile` to pass this test.
|
||||
#
|
||||
# Regression test for #8294
|
||||
rm ~/.nix-profile
|
||||
ln -s $NIX_STATE_DIR/profiles/per-user/me ~/.nix-profile
|
||||
testCollectGarbageD
|
||||
testCollectGarbageD --profile "$NIX_STATE_DIR/profiles/per-user/me"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user