summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-04-30 17:06:00 +0200
committerLudovic Courtès <ludo@gnu.org>2013-04-30 17:06:00 +0200
commit0734a9a8131525d6da2e7bf802402dc0350eda98 (patch)
treef43bef210f6513b12c14ee9494bb47e4f80e99d0 /tests
parente0fbbc889d724678e9e310432ad3a3fb8345cf9a (diff)
parent01155b1808b17f0a4f54388261ab0c6f5fee2f1b (diff)
Merge branch 'core-updates'
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 880dddd0b6f..1e6b62ee6a9 100644
--- a/tests/builders.scm
+++ b/tests/builders.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3;;; 3;;;
4;;; This file is part of GNU Guix. 4;;; This file is part of GNU Guix.
5;;; 5;;;
@@ -25,7 +25,8 @@
25 #:use-module (guix utils) 25 #:use-module (guix utils)
26 #:use-module (guix base32) 26 #:use-module (guix base32)
27 #:use-module (guix derivations) 27 #:use-module (guix derivations)
28 #:use-module ((guix packages) #:select (package-derivation)) 28 #:use-module ((guix packages)
29 #:select (package-derivation package-native-search-paths))
29 #:use-module (gnu packages bootstrap) 30 #:use-module (gnu packages bootstrap)
30 #:use-module (ice-9 match) 31 #:use-module (ice-9 match)
31 #:use-module (srfi srfi-1) 32 #:use-module (srfi srfi-1)
@@ -50,6 +51,13 @@
50 (list name (package-derivation %store package)))) 51 (list name (package-derivation %store package))))
51 (@@ (gnu packages base) %boot0-inputs)))) 52 (@@ (gnu packages base) %boot0-inputs))))
52 53
54(define %bootstrap-search-paths
55 ;; Search path specifications that go with %BOOTSTRAP-INPUTS.
56 (append-map (match-lambda
57 ((name package _ ...)
58 (package-native-search-paths package)))
59 (@@ (gnu packages base) %boot0-inputs)))
60
53(define network-reachable? 61(define network-reachable?
54 (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV))) 62 (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)))
55 63
@@ -83,7 +91,8 @@
83 (build (gnu-build %store "hello-2.8" tarball 91 (build (gnu-build %store "hello-2.8" tarball
84 %bootstrap-inputs 92 %bootstrap-inputs
85 #:implicit-inputs? #f 93 #:implicit-inputs? #f
86 #:guile %bootstrap-guile)) 94 #:guile %bootstrap-guile
95 #:search-paths %bootstrap-search-paths))
87 (out (derivation-path->output-path build))) 96 (out (derivation-path->output-path build)))
88 (and (build-derivations %store (list (pk 'hello-drv build))) 97 (and (build-derivations %store (list (pk 'hello-drv build)))
89 (valid-path? %store out) 98 (valid-path? %store out)
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 7b101aa501e..5a514a0dc00 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -47,6 +47,10 @@ test -L "$profile" && test -L "$profile-1-link"
47! test -f "$profile-2-link" 47! test -f "$profile-2-link"
48test -f "$profile/bin/guile" 48test -f "$profile/bin/guile"
49 49
50# No search path env. var. here.
51guix package --search-paths -p "$profile"
52test "`guix package --search-paths -p "$profile" | wc -l`" = 0
53
50# Check whether we have network access. 54# Check whether we have network access.
51if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null 55if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
52then 56then
@@ -119,6 +123,10 @@ then
119 rm "$profile-1-link" 123 rm "$profile-1-link"
120 guix package --bootstrap -p "$profile" --roll-back 124 guix package --bootstrap -p "$profile" --roll-back
121 test "`readlink_base "$profile"`" = "$profile-0-link" 125 test "`readlink_base "$profile"`" = "$profile-0-link"
126
127 # Make sure LIBRARY_PATH gets listed by `--search-paths'.
128 guix package --bootstrap -p "$profile" -i guile-bootstrap -i gcc-bootstrap
129 guix package --search-paths -p "$profile" | grep LIBRARY_PATH
122fi 130fi
123 131
124# Make sure the `:' syntax works. 132# Make sure the `:' syntax works.
diff --git a/tests/packages.scm b/tests/packages.scm
index 22985d6e9a6..1dd7b91ae88 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -22,6 +22,7 @@
22 #:use-module (guix utils) 22 #:use-module (guix utils)
23 #:use-module (guix derivations) 23 #:use-module (guix derivations)
24 #:use-module (guix packages) 24 #:use-module (guix packages)
25 #:use-module (guix build-system)
25 #:use-module (guix build-system trivial) 26 #:use-module (guix build-system trivial)
26 #:use-module (guix build-system gnu) 27 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages) 28 #:use-module (gnu packages)
@@ -160,6 +161,41 @@
160 (let ((p (pk 'drv d (derivation-path->output-path d)))) 161 (let ((p (pk 'drv d (derivation-path->output-path d))))
161 (eq? 'hello (call-with-input-file p read)))))) 162 (eq? 'hello (call-with-input-file p read))))))
162 163
164(test-assert "search paths"
165 (let* ((p (make-prompt-tag "return-search-paths"))
166 (s (build-system
167 (name "raw")
168 (description "Raw build system with direct store access")
169 (build (lambda* (store name source inputs
170 #:key outputs system search-paths)
171 search-paths))))
172 (x (list (search-path-specification
173 (variable "GUILE_LOAD_PATH")
174 (directories '("share/guile/site/2.0")))
175 (search-path-specification
176 (variable "GUILE_LOAD_COMPILED_PATH")
177 (directories '("share/guile/site/2.0")))))
178 (a (package (inherit (dummy-package "guile"))
179 (build-system s)
180 (native-search-paths x)))
181 (b (package (inherit (dummy-package "guile-foo"))
182 (build-system s)
183 (inputs `(("guile" ,a)))))
184 (c (package (inherit (dummy-package "guile-bar"))
185 (build-system s)
186 (inputs `(("guile" ,a)
187 ("guile-foo" ,b))))))
188 (let-syntax ((collect (syntax-rules ()
189 ((_ body ...)
190 (call-with-prompt p
191 (lambda ()
192 body ...)
193 (lambda (k search-paths)
194 search-paths))))))
195 (and (null? (collect (package-derivation %store a)))
196 (equal? x (collect (package-derivation %store b)))
197 (equal? x (collect (package-derivation %store c)))))))
198
163(unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)) 199(unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV))
164 (test-skip 1)) 200 (test-skip 1))
165(test-assert "GNU Make, bootstrap" 201(test-assert "GNU Make, bootstrap"
diff --git a/tests/utils.scm b/tests/utils.scm
index 2fc8eaec123..f14412e61ea 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -66,6 +66,16 @@
66 ("nixpkgs" "1.0pre22125_a28fe19") 66 ("nixpkgs" "1.0pre22125_a28fe19")
67 ("gtk2" "2.38.0")))) 67 ("gtk2" "2.38.0"))))
68 68
69(test-equal "string-tokenize*"
70 '(("foo")
71 ("foo" "bar" "baz")
72 ("foo" "bar" "")
73 ("foo" "bar" "baz"))
74 (list (string-tokenize* "foo" ":")
75 (string-tokenize* "foo;bar;baz" ";")
76 (string-tokenize* "foo!bar!" "!")
77 (string-tokenize* "foo+-+bar+-+baz" "+-+")))
78
69(test-equal "fold2, 1 list" 79(test-equal "fold2, 1 list"
70 (list (reverse (iota 5)) 80 (list (reverse (iota 5))
71 (map - (reverse (iota 5)))) 81 (map - (reverse (iota 5))))