summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorCarl Dong <accounts@carldong.me>2019-06-29 17:15:11 -0400
committerCarl Dong <contact@carldong.me>2019-07-08 10:33:20 -0400
commitb6dc08393e6a8313b88ce422fc3c1e4e9c0efc6f (patch)
treea3ca7a35febe75c42848c9f2256c1d62fa2c15a2 /tests
parenta655d504aa1dc04ab9c8916f2022f07ca89ceb3b (diff)
downloadguix-b6dc08393e6a8313b88ce422fc3c1e4e9c0efc6f.tar.gz
scripts: environment: Add --no-cwd.
* doc/guix.texi (Invoking guix environment): Add --no-cwd.
* guix/scripts/environment.scm (show-help, %options): Add --no-cwd.
(launch-environment/container): Add 'map-cwd?' param; only add mapping
for cwd if #t.  Only change to cwd within container if #t, otherwise
home.
(guix-environment): Error if --no-cwd without --container.  Provide
'(not no-cwd?)' to launch-environment/container as 'map-cwd?'.
* tests/guix-environment.sh: Add test for no-cwd.

Co-authored-by: Mike Gerwitz <mtg@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-environment.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
index a670db36be..5a5a69d58c 100644
--- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -84,6 +84,14 @@ echo "(use-modules (guix profiles) (gnu packages bootstrap))
 guix environment --bootstrap --manifest=$tmpdir/manifest.scm --pure \
      -- "$SHELL" -c 'test -f "$GUIX_ENVIRONMENT/bin/guile"'
 
+# if not sharing CWD, chdir home
+(
+  cd "$tmpdir" \
+    && guix environment --bootstrap --container --no-cwd --user=foo  \
+            --ad-hoc guile-bootstrap --pure \
+            -- /bin/sh -c 'test $(pwd) == "/home/foo" -a ! -d '"$tmpdir"
+)
+
 # Make sure '-r' works as expected.
 rm -f "$gcroot"
 expected="`guix environment --bootstrap --ad-hoc guile-bootstrap \