summary refs log tree commit diff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-06-09 23:16:55 +0200
committerLudovic Courtès <ludo@gnu.org>2012-06-09 23:16:55 +0200
commit9bc07f4df0b69b4eae86e8ca574713e3048d9a31 (patch)
tree8e1704a07333639a1f8d98e9a26cc4f0c1ec3626 /tests/derivations.scm
parent7946c4e710b921c9354ef74557872926d48ea42a (diff)
downloadguix-9bc07f4df0b69b4eae86e8ca574713e3048d9a31.tar.gz
Add multiple-output support to `build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Add `outputs'
  keyword parameter; pass it to `derivation'.  Define `%outputs' in the
  prologue.

* tests/derivations.scm ("build-expression->derivation with two
  outputs"): New test.
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r--tests/derivations.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 5d4fea8403..cbeedde4a1 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -145,6 +145,26 @@
            (equal? '(hello guix)
                    (call-with-input-file (string-append p "/test") read))))))
 
+(test-assert "build-expression->derivation with two outputs"
+  (let* ((builder    '(begin
+                        (call-with-output-file (assoc-ref %outputs "out")
+                          (lambda (p)
+                            (display '(hello) p)))
+                        (call-with-output-file (assoc-ref %outputs "second")
+                          (lambda (p)
+                            (display '(world) p)))))
+         (drv-path   (build-expression->derivation %store "double"
+                                                   "x86_64-linux"
+                                                   builder '()
+                                                   #:outputs '("out"
+                                                               "second")))
+         (succeeded? (build-derivations %store (list drv-path))))
+    (and succeeded?
+         (let ((one (derivation-path->output-path drv-path))
+               (two (derivation-path->output-path drv-path "second")))
+           (and (equal? '(hello) (call-with-input-file one read))
+                (equal? '(world) (call-with-input-file two read)))))))
+
 (test-assert "build-expression->derivation with one input"
   (let* ((builder    '(call-with-output-file %output
                         (lambda (p)