aboutsummaryrefslogtreecommitdiff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-08-26 22:19:21 +0200
committerLudovic Courtès <ludo@gnu.org>2013-08-26 22:20:58 +0200
commit9c629a27a435dd37b55a3944f8d79accc710a0e4 (patch)
treec2c70b74fd6459514ab7cbacb8f7560a89133b9a /tests/derivations.scm
parent5b0c9d1635df1608a498db8718af575d2f0e1663 (diff)
downloadpatches-9c629a27a435dd37b55a3944f8d79accc710a0e4.tar
patches-9c629a27a435dd37b55a3944f8d79accc710a0e4.tar.gz
derivations: Add #:dependency-graphs to `build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Add #:dependency-graphs keyword argument. Pass it to `derivation'. * tests/derivations.scm ("build-expression->derivation with #:dependency-graphs"): New test. * doc/guix.texi (Derivations): Update `build-expression->derivation' description.
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r--tests/derivations.scm34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 9b3d92a7bf..f9e6c28ec8 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -376,7 +376,7 @@
(and (valid-path? %store p)
(file-exists? (string-append p "/good")))))))
-(test-skip (if (%guile-for-build) 0 7))
+(test-skip (if (%guile-for-build) 0 8))
(test-assert "build-expression->derivation and derivation-prerequisites"
(let-values (((drv-path drv)
@@ -652,6 +652,38 @@ Deriver: ~a~%"
(derivation-path->output-path final2))
(build-derivations %store (list final1 final2)))))
+(test-assert "build-expression->derivation with #:dependency-graphs"
+ (let* ((input (add-text-to-store %store "foo" "hello"
+ (list %bash %mkdir)))
+ (builder '(copy-file "input" %output))
+ (drv (build-expression->derivation %store "dependency-graphs"
+ (%current-system)
+ builder '()
+ #:dependency-graphs
+ `(("input" . ,input))))
+ (out (derivation-path->output-path drv)))
+ (define (deps path . deps)
+ (let ((count (length deps)))
+ (string-append path "\n\n" (number->string count) "\n"
+ (string-join (sort deps string<?) "\n")
+ (if (zero? count) "" "\n"))))
+
+ (and (build-derivations %store (list drv))
+ (equal? (call-with-input-file out get-string-all)
+ (string-concatenate
+ (map cdr
+ (sort (map (lambda (p d)
+ (cons p (apply deps p d)))
+ (list input %bash %mkdir)
+ (list (list %bash %mkdir)
+ '() '()))
+ (lambda (x y)
+ (match x
+ ((p1 . _)
+ (match y
+ ((p2 . _)
+ (string<? p1 p2)))))))))))))
+
(test-end)