summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-build.sh27
-rw-r--r--tests/guix-environment-container.sh76
-rw-r--r--tests/guix-environment.sh14
-rw-r--r--tests/substitute.scm4
4 files changed, 119 insertions, 2 deletions
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index a72ce0911d..f7fb3c5b64 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -167,6 +167,33 @@ guix build -e "(begin
guix build -e '#~(mkdir #$output)' -d
guix build -e '#~(mkdir #$output)' -d | grep 'gexp\.drv'
+# Building from a package file.
+cat > "$module_dir/package.scm"<<EOF
+(use-modules (gnu))
+(use-package-modules bootstrap)
+
+%bootstrap-guile
+EOF
+guix build --file="$module_dir/package.scm"
+
+# Building from a monadic procedure file.
+cat > "$module_dir/proc.scm"<<EOF
+(use-modules (guix gexp))
+(lambda ()
+ (gexp->derivation "test"
+ (gexp (mkdir (ungexp output)))))
+EOF
+guix build --file="$module_dir/proc.scm" --dry-run
+
+# Building from a gexp file.
+cat > "$module_dir/gexp.scm"<<EOF
+(use-modules (guix gexp))
+
+(gexp (mkdir (ungexp output)))
+EOF
+guix build --file="$module_dir/gexp.scm" -d
+guix build --file="$module_dir/gexp.scm" -d | grep 'gexp\.drv'
+
# Using 'GUIX_BUILD_OPTIONS'.
GUIX_BUILD_OPTIONS="--dry-run"
export GUIX_BUILD_OPTIONS
diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh
new file mode 100644
index 0000000000..141fd160a7
--- /dev/null
+++ b/tests/guix-environment-container.sh
@@ -0,0 +1,76 @@
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2015 David Thompson <davet@gnu.org>
+#
+# This file is part of GNU Guix.
+#
+# GNU Guix is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Guix is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+#
+# Test 'guix environment'.
+#
+
+set -e
+
+guix environment --version
+
+tmpdir="t-guix-environment-$$"
+trap 'rm -r "$tmpdir"' EXIT
+
+mkdir "$tmpdir"
+
+# Make sure the exit value is preserved.
+if guix environment --container --ad-hoc --bootstrap guile-bootstrap \
+ -- guile -c '(exit 42)'
+then
+ false
+else
+ test $? = 42
+fi
+
+# Make sure that the right directories are mapped.
+mount_test_code="
+(use-modules (ice-9 rdelim)
+ (ice-9 match)
+ (srfi srfi-1))
+
+(define mappings
+ (filter-map (lambda (line)
+ (match (string-split line #\space)
+ ;; Empty line.
+ ((\"\") #f)
+ ;; Ignore these types of file systems.
+ ((_ _ (or \"tmpfs\" \"proc\" \"sysfs\" \"devtmpfs\"
+ \"devpts\" \"cgroup\" \"mqueue\") _ _ _)
+ #f)
+ ((_ mount _ _ _ _)
+ mount)))
+ (string-split (call-with-input-file \"/proc/mounts\" read-string)
+ #\newline)))
+
+(for-each (lambda (mount)
+ (display mount)
+ (newline))
+ mappings)"
+
+guix environment --container --ad-hoc --bootstrap guile-bootstrap \
+ -- guile -c "$mount_test_code" > $tmpdir/mounts
+
+cat "$tmpdir/mounts"
+test `wc -l < $tmpdir/mounts` -eq 3
+
+grep -e "$PWD$" $tmpdir/mounts # current directory
+grep $(guix build guile-bootstrap) $tmpdir/mounts
+grep -e "$NIX_STORE_DIR/.*-bash" $tmpdir/mounts # bootstrap bash
+
+rm $tmpdir/mounts
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
index f91c78a801..49b3b1ccc3 100644
--- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -97,4 +97,18 @@ then
# Make sure the "debug" output is not listed.
if grep -E "$make_boot0_debug" "$tmpdir/a"; then false; else true; fi
+
+ # Compute the build environment for the initial GNU Make, but add in the
+ # bootstrap Guile as an ad-hoc addition.
+ guix environment -e '(@@ (gnu packages commencement) gnu-make-boot0)' \
+ --ad-hoc guile-bootstrap --no-substitutes --search-paths \
+ --pure > "$tmpdir/a"
+
+ # Make sure the bootstrap binaries are all listed where they belong.
+ cat $tmpdir/a
+ grep -E '^export PATH=.*-bootstrap-binaries-0/bin' "$tmpdir/a"
+ grep -E '^export PATH=.*-guile-bootstrap-2.0/bin' "$tmpdir/a"
+ grep -E '^export CPATH=.*-gcc-bootstrap-0/include' "$tmpdir/a"
+ grep -E '^export CPATH=.*-glibc-bootstrap-0/include' "$tmpdir/a"
+ grep -E '^export LIBRARY_PATH=.*-glibc-bootstrap-0/lib' "$tmpdir/a"
fi
diff --git a/tests/substitute.scm b/tests/substitute.scm
index 85698127fa..9d907e7abf 100644
--- a/tests/substitute.scm
+++ b/tests/substitute.scm
@@ -167,8 +167,8 @@ a file for NARINFO."
(call-with-narinfo narinfo (lambda () body ...)))
;; Transmit these options to 'guix substitute'.
-(set! (@@ (guix scripts substitute) %cache-url)
- (getenv "GUIX_BINARY_SUBSTITUTE_URL"))
+(set! (@@ (guix scripts substitute) %cache-urls)
+ (list (getenv "GUIX_BINARY_SUBSTITUTE_URL")))
(test-equal "query narinfo without signature"
"" ; not substitutable