1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2015 David Thompson <davet@gnu.org>
4 # This file is part of GNU Guix.
6 # GNU Guix is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or (at
9 # your option) any later version.
11 # GNU Guix is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 # Test 'guix environment'.
25 guix environment
--version
27 tmpdir
="t-guix-environment-$$"
28 trap 'rm -r "$tmpdir"' EXIT
32 # Make sure the exit value is preserved.
33 if guix environment
--container --ad-hoc --bootstrap guile-bootstrap \
34 -- guile
-c '(exit 42)'
41 # Make sure that the right directories are mapped.
43 (use-modules (ice-9 rdelim)
48 (filter-map (lambda (line)
49 (match (string-split line #\space)
52 ;; Ignore these types of file systems.
53 ((_ _ (or \"tmpfs\" \"proc\" \"sysfs\" \"devtmpfs\"
54 \"devpts\" \"cgroup\" \"mqueue\") _ _ _)
58 (string-split (call-with-input-file \"/proc/mounts\" read-string)
61 (for-each (lambda (mount)
66 guix environment
--container --ad-hoc --bootstrap guile-bootstrap \
67 -- guile
-c "$mount_test_code" > $tmpdir/mounts
70 test `wc -l < $tmpdir/mounts` -eq 3
72 grep -e "$PWD$" $tmpdir/mounts
# current directory
73 grep $
(guix build guile-bootstrap
) $tmpdir/mounts
74 grep -e "$NIX_STORE_DIR/.*-bash" $tmpdir/mounts
# bootstrap bash