aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-environment-container.sh
Commit message (Collapse)AuthorAge
* environment: Turn "lo" up in network-less containers.Ludovic Courtès2020-10-05
| | | | | | | | This is a followup to 0f53c801b91919380a924b402d1ff822bb1dc6ea. * guix/scripts/environment.scm (launch-environment/container): Add call to 'set-network-interface-up'. * tests/guix-environment-container.sh: Add test.
* environment: Provide /etc/hosts in containers without '--network'.Ludovic Courtès2020-10-02
| | | | | | | | Fixes <https://bugs.gnu.org/43762>. * guix/scripts/environment.scm (launch-environment/container): Create /etc/hosts when NETWORK? is false. * tests/guix-environment-container.sh: Add "localhost" resolution test.
* environment: '--link-profile' uses ~/.guix-profile for environment variables.Ludovic Courtès2020-09-21
| | | | | | | | | | | | | | | | | | | | | | | | Before this patch, we had: $ guix environment -CP --ad-hoc coreutils [env]$ echo $PATH /gnu/store/…-profile/bin [env]$ echo $GUIX_ENVIRONMENT /gnu/store/…-profile After this patch: $ guix environment -CP --ad-hoc coreutils [env]$ echo $PATH /home/ludo/.guix-profile/bin [env]$ echo $GUIX_ENVIRONMENT /home/ludo/.guix-profile * guix/scripts/environment.scm (launch-environment/container): When LINK-PROFILE? is true, pass ~/.guix-profile as the second argument to 'launch-environment'. * tests/guix-environment-container.sh: Adjust test accordingly. * doc/guix.texi (Invoking guix environment): Update accordingly.
* tests: Actually run 'tests/guix-environment-container.sh'.Ludovic Courtès2020-06-20
| | | | | | | | | This test was skipped since the switch to Guile 3 because 'assert-container-features' would be inlined and thus accessing it with @@ would fail with an unbound-variable error. * guix/scripts/environment.scm (assert-container-features): Export. * tests/guix-environment-container.sh: Use single '@'.
* environment: '--container' honors '--preserve'.Ludovic Courtès2019-10-03
| | | | | | | * guix/scripts/environment.scm (launch-environment/container): Add #:white-list parameter and honor it. (guix-environment): Pass #:white-list to 'launch-environment/container'. * tests/guix-environment-container.sh: Add test.
* tests: Move 'guix environment -C --no-cwd' test where it belongs.Ludovic Courtès2019-08-17
| | | | | | | | | | This ensures that this test is skipped in contexts where user namespaces are not supported, instead of failing. This is a followup to commit b6dc08393e6a8313b88ce422fc3c1e4e9c0efc6f. * tests/guix-environment.sh: Move '--container --no-cwd' test to... * tests/guix-environment-container.sh: ... here.
* environment: '-C' creates namespaces where the user is not root.Ludovic Courtès2019-04-02
| | | | | | | | | * guix/scripts/environment.scm (launch-environment/container): Add UID and GID. Use them in PASSWD and GROUPS. Pass them as #:guest-uid and #:guest-gid to 'call-with-container'. * tests/guix-environment-container.sh: Test the inner UID. In '--user' test, replace hard-coded 0 with 1000. * doc/guix.texi (Invoking guix environment): Adjust accordingly.
* environment: Create /etc/group in containers.Ludovic Courtès2019-03-26
| | | | | | | | Reported by Pierre Neidhardt <mail@ambrevar.xyz>. * guix/scripts/environment.scm (launch-environment/container): Create GROUPS and call 'write-group'. * tests/guix-environment-container.sh: Test it.
* environment: Use (gnu build accounts) for /etc/passwd handling.Ludovic Courtès2019-03-26
| | | | | | | | | * guix/scripts/environment.scm (launch-environment/container): Remove call to 'mock-passwd'; instantiate a <password-entry> instead. Call 'write-passwd' to write the pasword database instead of using custom code. (mock-passwd): Remove. * tests/guix-environment-container.sh: Test 'getpwuid'.
* environment: Add --user.Mike Gerwitz2018-03-02
| | | | | | | | | | | | | | | | | | This change allows overriding the home directory of all filesystem mappings to help hide the identity of the calling user in a container. * doc/guix.texi (Invoking guix environment)[--container]: Mention --user. [--user]: Add item. * guix/scripts/environment.scm (show-help): Add --user. (%options): Add --user. (launch-environment/container) Add 'user' parameter. Update doc. Override 'user-mappings' using 'override-user-mappings'. Consider override for chdir. (mock-passwd, user-override-home, overrid-euser-dir): New procedures. (guix-environment): Disallow --user without --container. Provide user to 'launch-environment/container'. * tests/guix-environment.sh: Add user test. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* environment: Add --link-profile.Mike Gerwitz2018-03-02
| | | | | | | | | | | | | | | | | | | | | This change is motivated by attempts to run programs (like GNU IceCat) within containers. The 'fontconfig' program, for example, is configured explicitly to check ~/.guix-profile for additional fonts. There were no existing container tests in 'tests/guix-environment.sh', but I added one anyway for this change. * doc/guix.texi (Invoking guix environment): Add '--link-profile'. * guix/scripts/environment.scm (show-help): Add '--link-profile'. (%options): Add 'link-profile' as '#\P', assigned to 'link-profile?'. (link-environment): New procedure. (launch-environment/container): Use it when 'link-profile?'. [link-profile?]: New parameter. (guix-environment): Leave when '--link-prof' but not '--container'. Add '#:link-profile?' argument to 'launch-environment/container' application. * tests/guix-environment-container.sh: New '--link-profile' test. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* tests: Fix 'guix environment --container' test in the presence of tmpfs.Ludovic Courtès2016-08-29
| | | | | | | | Reported by Ting-Wei Lan <lantw44@gmail.com>. This is a followup to 1250034d5aff14fe236aad9900233a2b6f8563bb. * tests/guix-environment-container.sh (mount_test_code): Reverse order of 'string-prefix?' arguments.
* tests: 'guix-environment-container.sh' works when run from a tmpfs.Ludovic Courtès2016-07-31
| | | | | | | | | Fixes <http://bugs.gnu.org/22004>. Reported by Ting-Wei Lan <lantw44@gmail.com>. * tests/guix-environment-container.sh (mount_test_code): Add 'match' clause to ignore "/"; augment clause that ignores specific file system types such that it does not ignore parent mount points.
* container: Gracefully report mount errors in the child process.Ludovic Courtès2016-05-31
| | | | | | | | | | | | | Fixes <http://bugs.gnu.org/23306>. * gnu/build/linux-container.scm (run-container): Use 'socketpair' instead of 'pipe'. Rename 'in' to 'child' and 'out' to 'parent'. Send a 'ready message or an exception argument list from the child to the parent; adjust the parent accordingly. * tests/containers.scm ("call-with-container, mnt namespace, wrong bind mount"): New test. * tests/guix-environment-container.sh: Add test with --expose=/does-not-exist.
* environment: Properly handle SIGINT.David Thompson2016-03-27
| | | | | | | | | | | | | Switching to execlp means that the process spawned in a container is PID 1, which obsoleted one of the 'guix environment --container' tests because the init process can't be killed in the usual manner. * guix/scripts/environment.scm (launch-environment/fork): New procedure. (launch-environment): Switch from system* to execlp. Add handler for SIGINT. (guix-environment): Use launch-environment/fork. * tests/guix-environment-container.sh: Replace abnormal exit test with one that works now that the spawned process is PID 1.
* scripts: environment: Build environments as profiles.David Thompson2016-02-12
| | | | | | | | | | | | | | | | | | | | | | | | | Fixes <http://bugs.gnu.org/19816>. * guix/scripts/environment.scm (evaluate-input-search-paths) (build-inputs): Delete. (evaluate-profile-search-paths, strip-input-name) (package-or-package+output?, package-environment-inputs) (build-environment, inputs->profile-derivations): New procedures. (create-environment, show-search-paths, launch-environment) (launch-environment/container): Replace 'inputs' argument with 'profile' argument. (package+propagated-inputs): Strip off names off of input tuples. (options/resolve-packages): Handle input tuples that specify an output in expressions. (guix-environment): Convert inputs into a profile to use in the environment. Remove non-package inputs such as origins from environment inputs. * doc/guix.texi ("invoking guix environment"): Document package+output tuples for --expression option. * tests/guix-environment.sh: Update tests. * tests/guix-environment-container.sh: Likewise. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* environment: Correctly handle abnormal exits.Ludovic Courtès2015-11-21
| | | | | | | | Fixes <http://bugs.gnu.org/21958>. * guix/scripts/environment.scm (status->exit-code): New procedure. (exit/status, primitive-exit/status): Use it. * tests/guix-environment-container.sh: Add test.
* tests: Skip 'guix-container-environment.sh' when support is missing.Ludovic Courtès2015-11-21
| | | | | | | | Fixes <http://bugs.gnu.org/21410>. Reported by Alex Vong <alexvong1995@gmail.com>. * tests/guix-environment-container.sh: Exit with 77 when '((@@ (guix scripts environment) assert-container-features))' fails.
* tests: Use the canonical current directory name.Ludovic Courtès2015-11-04
| | | | | * tests/guix-environment-container.sh (current_dir): New variable. Use it when grepping "mounts".
* tests: Print the mounts visible in the container.Ludovic Courtès2015-10-28
| | | | | * tests/guix-environment-container.sh: Print the content of $tmpdir/mounts.
* scripts: environment: Add --container option.David Thompson2015-10-25
* guix/scripts/system.scm (specification->file-system-mapping): Move from here... * guix/ui.scm (specification->file-system-mapping): ... to here. * guix/scripts/enviroment.scm (show-help): Show help for new options. (%options): Add --container --network, --expose, and --share options. (%network-configuration-files): New variable. (launch-environment, launch-environment/container, requisites*, inputs->requisites): New procedures. (guix-environment): Spawn new process in a container when requested. * doc/guix.texi (Invoking guix environment): Document it. * tests/guix-environment-container.sh: New file. * Makefile.am (SH_TESTS): Add it.