summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-06-11 23:12:55 +0200
committerLudovic Courtès <ludo@gnu.org>2012-06-11 23:12:55 +0200
commit99634e3ff4e16edc1c14145a5913d7c1440dc479 (patch)
tree213c69ff6e85680c85b66a03454118a163a32b88 /tests
parent0e383c76ce4fb94b47bd69f493ac3e1858b879f0 (diff)
downloadpatches-99634e3ff4e16edc1c14145a5913d7c1440dc479.tar
patches-99634e3ff4e16edc1c14145a5913d7c1440dc479.tar.gz
Add `imported-files'.
* guix/derivations.scm (imported-files): New procedure. (build-expression->derivation): Correctly handle inputs that are sources and not derivation paths. * tests/derivations.scm ("imported-files"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index ec48f44420..1a85639930 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -24,11 +24,13 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-34)
#:use-module (srfi srfi-64)
#:use-module (rnrs io ports)
#:use-module (rnrs bytevectors)
#:use-module (ice-9 rdelim)
- #:use-module (ice-9 ftw))
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 match))
(define %store
(false-if-exception (open-connection)))
@@ -156,7 +158,7 @@
(let ((p (derivation-path->output-path drv-path)))
(file-exists? (string-append p "/good"))))))
-(test-skip (if (%guile-for-build) 0 2))
+(test-skip (if (%guile-for-build) 0 4))
(test-assert "build-expression->derivation without inputs"
(let* ((builder '(begin
@@ -208,6 +210,22 @@
(let ((p (derivation-path->output-path drv-path)))
(string-contains (call-with-input-file p read-line) "GNU")))))
+(test-assert "imported-files"
+ (let* ((files `(("x" . ,(search-path %load-path "ice-9/q.scm"))
+ ("a/b/c" . ,(search-path %load-path
+ "guix/derivations.scm"))
+ ("p/q" . ,(search-path %load-path "guix.scm"))))
+ (drv-path (imported-files %store files)))
+ (and (build-derivations %store (list drv-path))
+ (let ((dir (derivation-path->output-path drv-path)))
+ (every (match-lambda
+ ((path . source)
+ (equal? (call-with-input-file (string-append dir "/" path)
+ get-bytevector-all)
+ (call-with-input-file source
+ get-bytevector-all))))
+ files)))))
+
(test-skip (if (false-if-exception (getaddrinfo "ftp.gnu.org" "http"))
0
1))