summary refs log tree commit diff
path: root/tests/guix-package.sh
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2014-10-10 17:58:43 +0400
committerAlex Kost <alezost@gmail.com>2014-10-12 08:45:38 +0400
commitb3bb82f1542ec0805b87305482829102f2faaa92 (patch)
treee209c5e03ff1ad44068bf84e6f2402a364ed42fa /tests/guix-package.sh
parent3ccde087528cc04ef5275224ca6123b68e075e3c (diff)
downloadguix-b3bb82f1542ec0805b87305482829102f2faaa92.tar.gz
guix package: Add '--switch-generation' option.
* guix/scripts/package.scm (switch-to-generation): New procedure.
  (switch-to-previous-generation): Use it.
  (guix-package): Adjust for '--switch-generation' option.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Invoking guix package): Document it.
Diffstat (limited to 'tests/guix-package.sh')
-rw-r--r--tests/guix-package.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index e35871f2a2..3e0e36fa23 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -87,6 +87,8 @@ then
     # Exit with 1 when a generation does not exist.
     if guix package -p "$profile" --list-generations=42;
     then false; else true; fi
+    if guix package -p "$profile" --switch-generation=99;
+    then false; else true; fi
 
     # Remove a package.
     guix package --bootstrap -p "$profile" -r "guile-bootstrap"
@@ -101,6 +103,12 @@ then
     test "`readlink_base "$profile"`" = "$profile-1-link"
     test -x "$profile/bin/guile" && ! test -x "$profile/bin/make"
 
+    # Switch to the rolled generation and switch back.
+    guix package -p "$profile" --switch-generation=2
+    test "`readlink_base "$profile"`" = "$profile-2-link"
+    guix package -p "$profile" --switch-generation=-1
+    test "`readlink_base "$profile"`" = "$profile-1-link"
+
     # Move to the empty profile.
     for i in `seq 1 3`
     do
@@ -133,10 +141,12 @@ then
     grep "`guix build -e "$boot_make"`" "$profile/manifest"
 
     # Make a "hole" in the list of generations, and make sure we can
-    # roll back "over" it.
+    # roll back and switch "over" it.
     rm "$profile-1-link"
     guix package --bootstrap -p "$profile" --roll-back
     test "`readlink_base "$profile"`" = "$profile-0-link"
+    guix package -p "$profile" --switch-generation=+1
+    test "`readlink_base "$profile"`" = "$profile-2-link"
 
     # Make sure LIBRARY_PATH gets listed by `--search-paths'.
     guix package --bootstrap -p "$profile" -i guile-bootstrap -i gcc-bootstrap