summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/builders.scm15
-rw-r--r--tests/guix-package.sh8
-rw-r--r--tests/packages.scm36
-rw-r--r--tests/utils.scm10
4 files changed, 66 insertions, 3 deletions
diff --git a/tests/builders.scm b/tests/builders.scm
index 880dddd0b6..1e6b62ee6a 100644
--- a/tests/builders.scm
+++ b/tests/builders.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,7 +25,8 @@
   #:use-module (guix utils)
   #:use-module (guix base32)
   #:use-module (guix derivations)
-  #:use-module ((guix packages) #:select (package-derivation))
+  #:use-module ((guix packages)
+                #:select (package-derivation package-native-search-paths))
   #:use-module (gnu packages bootstrap)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
@@ -50,6 +51,13 @@
               (list name (package-derivation %store package))))
             (@@ (gnu packages base) %boot0-inputs))))
 
+(define %bootstrap-search-paths
+  ;; Search path specifications that go with %BOOTSTRAP-INPUTS.
+  (append-map (match-lambda
+               ((name package _ ...)
+                (package-native-search-paths package)))
+              (@@ (gnu packages base) %boot0-inputs)))
+
 (define network-reachable?
   (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)))
 
@@ -83,7 +91,8 @@
          (build    (gnu-build %store "hello-2.8" tarball
                               %bootstrap-inputs
                               #:implicit-inputs? #f
-                              #:guile %bootstrap-guile))
+                              #:guile %bootstrap-guile
+                              #:search-paths %bootstrap-search-paths))
          (out      (derivation-path->output-path build)))
     (and (build-derivations %store (list (pk 'hello-drv build)))
          (valid-path? %store out)
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 7b101aa501..5a514a0dc0 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -47,6 +47,10 @@ test -L "$profile" && test -L "$profile-1-link"
 ! test -f "$profile-2-link"
 test -f "$profile/bin/guile"
 
+# No search path env. var. here.
+guix package --search-paths -p "$profile"
+test "`guix package --search-paths -p "$profile" | wc -l`" = 0
+
 # Check whether we have network access.
 if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
 then
@@ -119,6 +123,10 @@ then
     rm "$profile-1-link"
     guix package --bootstrap -p "$profile" --roll-back
     test "`readlink_base "$profile"`" = "$profile-0-link"
+
+    # Make sure LIBRARY_PATH gets listed by `--search-paths'.
+    guix package --bootstrap -p "$profile" -i guile-bootstrap -i gcc-bootstrap
+    guix package --search-paths -p "$profile" | grep LIBRARY_PATH
 fi
 
 # Make sure the `:' syntax works.
diff --git a/tests/packages.scm b/tests/packages.scm
index 22985d6e9a..1dd7b91ae8 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -22,6 +22,7 @@
   #:use-module (guix utils)
   #:use-module (guix derivations)
   #:use-module (guix packages)
+  #:use-module (guix build-system)
   #:use-module (guix build-system trivial)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
@@ -160,6 +161,41 @@
          (let ((p (pk 'drv d (derivation-path->output-path d))))
            (eq? 'hello (call-with-input-file p read))))))
 
+(test-assert "search paths"
+  (let* ((p (make-prompt-tag "return-search-paths"))
+         (s (build-system
+             (name "raw")
+             (description "Raw build system with direct store access")
+             (build (lambda* (store name source inputs
+                                    #:key outputs system search-paths)
+                      search-paths))))
+         (x (list (search-path-specification
+                   (variable "GUILE_LOAD_PATH")
+                   (directories '("share/guile/site/2.0")))
+                  (search-path-specification
+                   (variable "GUILE_LOAD_COMPILED_PATH")
+                   (directories '("share/guile/site/2.0")))))
+         (a (package (inherit (dummy-package "guile"))
+              (build-system s)
+              (native-search-paths x)))
+         (b (package (inherit (dummy-package "guile-foo"))
+              (build-system s)
+              (inputs `(("guile" ,a)))))
+         (c (package (inherit (dummy-package "guile-bar"))
+              (build-system s)
+              (inputs `(("guile" ,a)
+                        ("guile-foo" ,b))))))
+    (let-syntax ((collect (syntax-rules ()
+                            ((_ body ...)
+                             (call-with-prompt p
+                               (lambda ()
+                                 body ...)
+                               (lambda (k search-paths)
+                                 search-paths))))))
+      (and (null? (collect (package-derivation %store a)))
+           (equal? x (collect (package-derivation %store b)))
+           (equal? x (collect (package-derivation %store c)))))))
+
 (unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV))
   (test-skip 1))
 (test-assert "GNU Make, bootstrap"
diff --git a/tests/utils.scm b/tests/utils.scm
index 2fc8eaec12..f14412e61e 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -66,6 +66,16 @@
            ("nixpkgs" "1.0pre22125_a28fe19")
            ("gtk2" "2.38.0"))))
 
+(test-equal "string-tokenize*"
+  '(("foo")
+    ("foo" "bar" "baz")
+    ("foo" "bar" "")
+    ("foo" "bar" "baz"))
+  (list (string-tokenize* "foo" ":")
+        (string-tokenize* "foo;bar;baz" ";")
+        (string-tokenize* "foo!bar!" "!")
+        (string-tokenize* "foo+-+bar+-+baz" "+-+")))
+
 (test-equal "fold2, 1 list"
     (list (reverse (iota 5))
           (map - (reverse (iota 5))))