guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/07: tests: Add tests for 'guix environment'.


From: Ludovic Courtès
Subject: 01/07: tests: Add tests for 'guix environment'.
Date: Wed, 01 Jul 2015 13:11:12 +0000

civodul pushed a commit to branch wip-environment
in repository guix.

commit b53f7e74feff093f37665cbe79dca673af12933a
Author: Ludovic Courtès <address@hidden>
Date:   Tue Jun 30 12:35:27 2015 +0200

    tests: Add tests for 'guix environment'.
    
    * tests/guix-environment.sh: New file.
    * Makefile.am (SH_TESTS): Add it.
---
 Makefile.am               |    1 +
 tests/guix-environment.sh |   61 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 22ee938..cc0b135 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -223,6 +223,7 @@ SH_TESTS =                                  \
   tests/guix-system.sh                         \
   tests/guix-archive.sh                                \
   tests/guix-authenticate.sh                   \
+  tests/guix-environment.sh                    \
   tests/guix-lint.sh
 
 if BUILD_DAEMON
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
new file mode 100644
index 0000000..3d92d22
--- /dev/null
+++ b/tests/guix-environment.sh
@@ -0,0 +1,61 @@
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2015 Ludovic Courtès <address@hidden>
+#
+# 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"
+
+# Check the environment variables for the bootstrap Guile.
+guix environment --ad-hoc guile-bootstrap --pure --search-paths > "$tmpdir/a"
+
+# $PATH must appear in the search paths, and nothing else.
+grep -E '^export PATH=.*guile-bootstrap-[0-9.]+/bin' "$tmpdir/a"
+test "`wc -l < "$tmpdir/a"`" = 1
+
+if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
+then
+    # Compute the build environment for the initial GNU Make.
+    guix environment -e '(@@ (gnu packages commencement) gnu-make-boot0)' \
+        --no-substitutes --search-paths --pure > "$tmpdir/a"
+
+    # Make sure the bootstrap binaries are all listed where they belong.
+    grep -E '^export PATH=.*-bootstrap-binaries-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"
+
+    # 'make-boot0' itself must not be listed.
+    if grep "make-boot0" "$tmpdir/a"; then false; else true; fi
+
+    # Make sure that the shell spawned with '--exec' sees the same environment
+    # as returned by '--search-paths'.
+    guix environment -e '(@@ (gnu packages commencement) gnu-make-boot0)'      
\
+        --no-substitutes --pure                                                
\
+         --exec='echo $PATH $CPATH $LIBRARY_PATH' > "$tmpdir/b"
+    ( . "$tmpdir/a" ; echo $PATH $CPATH $LIBRARY_PATH ) > "$tmpdir/c"
+    cmp "$tmpdir/b" "$tmpdir/c"
+fi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]