summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-01-03 14:53:03 +0100
committerLudovic Courtès <ludo@gnu.org>2016-01-03 14:53:03 +0100
commit53334dd6e9e296e17110ebcd2b1f93f117ffe36a (patch)
tree2653db2eab9a204dab892ea8b6812cadf7209e84 /tests
parent1575dcd134f4fae7255787293f4988bbd043de95 (diff)
parent51385362f76e2f823ac8d8cf720d06c386504069 (diff)
downloadguix-53334dd6e9e296e17110ebcd2b1f93f117ffe36a.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests')
-rw-r--r--tests/graph.scm35
-rw-r--r--tests/guix-package.sh4
-rw-r--r--tests/guix-system.sh32
-rw-r--r--tests/packages.scm21
-rw-r--r--tests/profiles.scm9
5 files changed, 92 insertions, 9 deletions
diff --git a/tests/graph.scm b/tests/graph.scm
index ad8aea0ada..4f85432d2f 100644
--- a/tests/graph.scm
+++ b/tests/graph.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -89,16 +89,18 @@ edges."
 
 (test-assert "bag-emerged DAG"
   (let-values (((backend nodes+edges) (make-recording-backend)))
-    (let ((p        (dummy-package "p"))
-          (implicit (map (match-lambda
-                           ((label package) package))
-                         (standard-packages))))
+    (let* ((o        (dummy-origin (method (lambda _
+                                             (text-file "foo" "bar")))))
+           (p        (dummy-package "p" (source o)))
+           (implicit (map (match-lambda
+                            ((label package) package))
+                          (standard-packages))))
       (run-with-store %store
         (export-graph (list p) 'port
                       #:node-type %bag-emerged-node-type
                       #:backend backend))
       ;; We should see exactly P and IMPLICIT, with one edge from P to each
-      ;; element of IMPLICIT.
+      ;; element of IMPLICIT.  O must not appear among NODES.
       (let-values (((nodes edges) (nodes+edges)))
         (and (equal? (match nodes
                        (((labels names) ...)
@@ -148,7 +150,8 @@ edges."
       (let-values (((nodes edges) (nodes+edges)))
         (run-with-store %store
           (mlet %store-monad ((o* (lower-object o))
-                              (p* (lower-object p)))
+                              (p* (lower-object p))
+                              (g  (lower-object (default-guile))))
             (return
              (and (find (match-lambda
                           ((file "the-uri") #t)
@@ -158,6 +161,13 @@ edges."
                           ((source target)
                            (and (string=? source (derivation-file-name p*))
                                 (string=? target o*))))
+                        edges)
+
+                  ;; There must also be an edge from O to G.
+                  (find (match-lambda
+                          ((source target)
+                           (and (string=? source o*)
+                                (string=? target (derivation-file-name g)))))
                         edges)))))))))
 
 (test-assert "derivation DAG"
@@ -250,6 +260,17 @@ edges."
                                        (bootstrap? package)))
                                  diff))))))))
 
+(test-assert "node-transitive-edges, no duplicates"
+  (run-with-store %store
+    (let* ((p0  (dummy-package "p0"))
+           (p1a (dummy-package "p1a" (inputs `(("p0" ,p0)))))
+           (p1b (dummy-package "p1b" (inputs `(("p0" ,p0)))))
+           (p2  (dummy-package "p2" (inputs `(("p1a" ,p1a) ("p1b" ,p1b))))))
+      (mlet %store-monad ((edges (node-edges %package-node-type
+                                             (list p2 p1a p1b p0))))
+        (return (lset= eq? (node-transitive-edges (list p2) edges)
+                       (list p1a p1b p0)))))))
+
 (test-end "graph")
 
 
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index bb1037044d..5e6ff8b012 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -225,6 +225,10 @@ cat > "$module_dir/foo.scm"<<EOF
 EOF
 guix package -i emacs-foo-bar-patched -n
 
+# Same when -L is used.
+( unset GUIX_PACKAGE_PATH;					\
+  guix package -L "$module_dir" -i emacs-foo-bar-patched -n )
+
 # Make sure installing from a file works.
 cat > "$module_dir/package.scm"<<EOF
 (use-modules (gnu))
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index e20bc98713..02e2524d9e 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -17,7 +17,7 @@
 # along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 #
-# Test the daemon and its interaction with 'guix substitute'.
+# Test 'guix system', mostly error reporting.
 #
 
 set -e
@@ -26,7 +26,15 @@ guix system --version
 
 tmpfile="t-guix-system-$$"
 errorfile="t-guix-system-error-$$"
-trap 'rm -f "$tmpfile" "$errorfile"' EXIT
+
+# Note: This directory is chosen outside $builddir so that relative file name
+# canonicalization doesn't mess up with 'current-source-directory', used by
+# 'local-file' ('load' forces 'relative' for
+# %FILE-PORT-NAME-CANONICALIZATION.)
+tmpdir="${TMPDIR:-/tmp}/t-guix-system-$$"
+mkdir "$tmpdir"
+
+trap 'rm -f "$tmpfile" "$errorfile" "$tmpdir"/*; rmdir "$tmpdir"' EXIT
 
 # Reporting of syntax errors.
 
@@ -180,3 +188,23 @@ make_user_config "users" "group-that-does-not-exist"
 if guix system build "$tmpfile" -n 2> "$errorfile"
 then false
 else grep "supplementary group.*group-that-does-not-exist.*undeclared" "$errorfile"; fi
+
+# Try 'local-file' and relative file name resolution.
+
+cat > "$tmpdir/config.scm"<<EOF
+(use-modules (gnu))
+(use-service-modules networking)
+
+(operating-system
+  $OS_BASE
+  (services (cons (tor-service (local-file "my-torrc"))
+                  %base-services)))
+EOF
+
+cat > "$tmpdir/my-torrc"<<EOF
+# This is an example file.
+EOF
+
+# In both cases 'my-torrc' should be properly resolved.
+guix system build "$tmpdir/config.scm" -n
+(cd "$tmpdir"; guix system build "config.scm" -n)
diff --git a/tests/packages.scm b/tests/packages.scm
index b28ae0b662..6a2f4f06e1 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -29,6 +29,7 @@
   #:use-module (guix hash)
   #:use-module (guix derivations)
   #:use-module (guix packages)
+  #:use-module (guix search-paths)
   #:use-module (guix build-system)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system gnu)
@@ -504,6 +505,26 @@
            (equal? x (collect (package-derivation %store b)))
            (equal? x (collect (package-derivation %store c)))))))
 
+(test-assert "package-transitive-native-search-paths"
+  (let* ((sp (lambda (name)
+               (list (search-path-specification
+                      (variable name)
+                      (files '("foo/bar"))))))
+         (p0 (dummy-package "p0" (native-search-paths (sp "PATH0"))))
+         (p1 (dummy-package "p1" (native-search-paths (sp "PATH1"))))
+         (p2 (dummy-package "p2"
+               (native-search-paths (sp "PATH2"))
+               (inputs `(("p0" ,p0)))
+               (propagated-inputs `(("p1" ,p1)))))
+         (p3 (dummy-package "p3"
+               (native-search-paths (sp "PATH3"))
+               (native-inputs `(("p0" ,p0)))
+               (propagated-inputs `(("p2" ,p2))))))
+    (lset= string=?
+           '("PATH1" "PATH2" "PATH3")
+           (map search-path-specification-variable
+                (package-transitive-native-search-paths p3)))))
+
 (test-assert "package-cross-derivation"
   (let ((drv (package-cross-derivation %store (dummy-package "p")
                                        "mips64el-linux-gnu")))
diff --git a/tests/profiles.scm b/tests/profiles.scm
index cc9a822cee..e659c2e26d 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -32,6 +32,7 @@
   #:use-module (ice-9 regex)
   #:use-module (ice-9 popen)
   #:use-module (rnrs io ports)
+  #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-64))
 
@@ -224,6 +225,14 @@
                            (package-native-search-paths
                             packages:guile-2.0)))))))))
 
+(test-assert "package->manifest-entry, search paths"
+  ;; See <http://bugs.gnu.org/22073>.
+  (let ((mpl (@ (gnu packages python) python2-matplotlib)))
+    (lset= eq?
+           (package-transitive-native-search-paths mpl)
+           (manifest-entry-search-paths
+            (package->manifest-entry mpl)))))
+
 (test-assertm "etc/profile"
   ;; Make sure we get an 'etc/profile' file that at least defines $PATH.
   (mlet* %store-monad