aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-environment.sh
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-12-20 19:06:22 +0100
committerLudovic Courtès <ludo@gnu.org>2016-12-20 19:14:41 +0100
commitf943c317fb714075b455d4a30f631c8cb45732b4 (patch)
tree7f70c29bb007f7e81f0e2884d1307237de59e6b2 /tests/guix-environment.sh
parent7d2511bc6b467c056e7e0bcb0760f7b9652ba083 (diff)
downloadgnu-guix-f943c317fb714075b455d4a30f631c8cb45732b4.tar
gnu-guix-f943c317fb714075b455d4a30f631c8cb45732b4.tar.gz
environment: Add '--root' option.
* guix/scripts/environment.scm (show-help, %options): Add --root. (register-gc-root): New procedure. (guix-environment): Call 'register-gc-root' when OPTS has a 'gc-root' option. * doc/guix.texi (Invoking guix environment): Document it. * tests/guix-environment.sh: Add tests.
Diffstat (limited to 'tests/guix-environment.sh')
-rw-r--r--tests/guix-environment.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
index 68343520b0..2b3bbfe036 100644
--- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -25,7 +25,8 @@ set -e
guix environment --version
tmpdir="t-guix-environment-$$"
-trap 'rm -r "$tmpdir"' EXIT
+gcroot="t-guix-environment-gc-root-$$"
+trap 'rm -r "$tmpdir"; rm -f "$gcroot"' EXIT
mkdir "$tmpdir"
@@ -61,6 +62,20 @@ fi
guix environment --bootstrap --ad-hoc guile-bootstrap --pure \
-- "$SHELL" -c 'test -f "$GUIX_ENVIRONMENT/bin/guile"'
+# Make sure '-r' works as expected.
+rm -f "$gcroot"
+expected="`guix environment --bootstrap --ad-hoc guile-bootstrap \
+ -- "$SHELL" -c 'echo $GUIX_ENVIRONMENT'`"
+guix environment --bootstrap -r "$gcroot" --ad-hoc guile-bootstrap \
+ -- guile -c 1
+test `readlink "$gcroot"` = "$expected"
+
+# Make sure '-r' is idempotent.
+guix environment --bootstrap -r "$gcroot" --ad-hoc guile-bootstrap \
+ -- guile -c 1
+test `readlink "$gcroot"` = "$expected"
+
+
case "`uname -m`" in
x86_64)
# On x86_64, we should be able to create a 32-bit environment.