summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTomas Volf <~@wolfsden.cz>2026-05-14 21:26:16 +0200
committerMaxim Cournoyer <maxim@guixotic.coop>2026-06-15 10:48:17 +0900
commitd11615f609d2cd58fb1305205a4fa975dc8e4657 (patch)
tree7f282d90f61523ff71c5d342aaa53ed7dd98b5bb /tests
parent2c646830c1de33fba8e761b86a173041150a030c (diff)
environment: Allow setting environment variables with -E.
* guix/scripts/environment.scm (show-environment-options-help) [-E]: Document the change. * guix/scripts/environment.scm (%options) [-E]: If arg contains =, split it and store under 'extra-env. * guix/scripts/environment.scm (launch-environment, launch-environment/fork) (launch-environment/container): Take and use `environment-variables' keyword argument. * guix/scripts/environment.scm (guix-environment*): Process 'environment-variables opts. * guix/profiles.scm (load-profile): Add `environment-variables' keyword argument. * doc/guix.texi (Invoking guix shell): Document the change. * tests/guix-environment.sh (GUIX_TEST_ZZZ): Test it. Change-Id: Ib1db19ef73dda8f561b05731079a96eda076e365 Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop> Modified-by: Maxim Cournoyer <maxim@guixotic.coop>
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-environment.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
index 56cb289f2ff..450f0265221 100644
--- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -49,18 +49,21 @@ test -x `sed -r 's/^export PATH="(.*)"/\1/' "$tmpdir/a"`/guile
49 49
50cmp "$tmpdir/a" "$tmpdir/b" 50cmp "$tmpdir/a" "$tmpdir/b"
51 51
52# Check '--preserve'. 52# Check '--preserve', as well as its -E VAR=VALUE special case.
53GUIX_TEST_ABC=1 53GUIX_TEST_ABC=1
54GUIX_TEST_DEF=2 54GUIX_TEST_DEF=2
55GUIX_TEST_XYZ=3 55GUIX_TEST_XYZ=3
56GUIX_TEST_ZZZ=4
56export GUIX_TEST_ABC GUIX_TEST_DEF GUIX_TEST_XYZ 57export GUIX_TEST_ABC GUIX_TEST_DEF GUIX_TEST_XYZ
57guix environment --bootstrap --ad-hoc guile-bootstrap --pure \ 58guix environment --bootstrap --ad-hoc guile-bootstrap --pure \
58 --preserve='^GUIX_TEST_A' --preserve='^GUIX_TEST_D' \ 59 --preserve='^GUIX_TEST_A' --preserve='^GUIX_TEST_D' \
60 --preserve='^GUIX_TEST_Z' -E 'GUIX_TEST_ZZZ=overridden' \
59 -- "$SHELL" -c set > "$tmpdir/a" 61 -- "$SHELL" -c set > "$tmpdir/a"
60grep '^PATH=' "$tmpdir/a" 62grep '^PATH=' "$tmpdir/a"
61grep '^GUIX_TEST_ABC=1' "$tmpdir/a" 63grep '^GUIX_TEST_ABC=1' "$tmpdir/a"
62grep '^GUIX_TEST_DEF=2' "$tmpdir/a" 64grep '^GUIX_TEST_DEF=2' "$tmpdir/a"
63grep '^GUIX_TEST_XYZ=3' "$tmpdir/a" && false 65grep '^GUIX_TEST_XYZ=3' "$tmpdir/a" && false
66grep '^GUIX_TEST_ZZZ=overridden' "$tmpdir/a"
64 67
65# Make sure the exit value is preserved. 68# Make sure the exit value is preserved.
66if guix environment --bootstrap --ad-hoc guile-bootstrap --pure \ 69if guix environment --bootstrap --ad-hoc guile-bootstrap --pure \