aboutsummaryrefslogtreecommitdiff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
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)