From d58ceae022ad887686e55068db7229f931eb96af Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 26 Feb 2014 18:45:26 +0100 Subject: [PATCH] Test nix-env --switch-generation --- tests/user-envs.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/user-envs.sh b/tests/user-envs.sh index ab445a8ee..0d997acd6 100644 --- a/tests/user-envs.sh +++ b/tests/user-envs.sh @@ -86,7 +86,9 @@ if nix-env -q '*' | grep -q foo; then false; fi nix-env -q '*' | grep -q bar # Rollback: should bring "foo" back. +oldGen="$(nix-store -q --resolve $profiles/test)" nix-env --rollback +[ "$(nix-store -q --resolve $profiles/test)" != "$oldGen" ] nix-env -q '*' | grep -q foo-2.0 nix-env -q '*' | grep -q bar @@ -99,6 +101,10 @@ if nix-env -q '*' | grep -q bar; then false; fi nix-env --list-generations test "$(nix-env --list-generations | wc -l)" -eq 7 +# Switch to a specified generation. +nix-env --switch-generation 7 +[ "$(nix-store -q --resolve $profiles/test)" = "$oldGen" ] + # Install foo-1.0, now using its store path. nix-env -i "$outPath10" nix-env -q '*' | grep -q foo-1.0