summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-07-02 01:23:39 +0200
committerLudovic Courtès <ludo@gnu.org>2012-07-02 01:35:39 +0200
commitd66ac374e9c8c50893b3ac339665259f2f167669 (patch)
treee049c3dab726798b0175d01e642e346450032cc4 /tests
parent5f904ffbb1b04adeb57b90d529ed0fac0209e0ff (diff)
downloadguix-d66ac374e9c8c50893b3ac339665259f2f167669.tar.gz
derivation: Coalesce multiple occurrences of the same input.
* guix/derivations.scm (write-derivation)[coalesce-duplicate-inputs]:
  New procedure.
  Use it to process INPUTS.

* tests/derivations.scm ("user of multiple-output derivation"): New
  test.
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index cdb1942539..097b9d7d28 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -163,6 +163,38 @@
            (and (eq? 'one (call-with-input-file one read))
                 (eq? 'two (call-with-input-file two read)))))))
 
+(test-assert "user of multiple-output derivation"
+  ;; Check whether specifying several inputs coming from the same
+  ;; multiple-output derivation works.
+  (let* ((builder1   (add-text-to-store %store "my-mo-builder.sh"
+                                        "echo one > $out ; echo two > $two"
+                                        '()))
+         (mdrv       (derivation %store "multiple-output" (%current-system)
+                                 "/bin/sh" `(,builder1)
+                                 '()
+                                 `((,builder1))
+                                 #:outputs '("out" "two")))
+         (builder2   (add-text-to-store %store "my-mo-user-builder.sh"
+                                        "read x < $one;
+                                         read y < $two;
+                                         echo \"($x $y)\" > $out"
+                                        '()))
+         (udrv       (derivation %store "multiple-output-user"
+                                 (%current-system)
+                                 "/bin/sh" `(,builder2)
+                                 `(("one" . ,(derivation-path->output-path
+                                              mdrv "out"))
+                                   ("two" . ,(derivation-path->output-path
+                                              mdrv "two")))
+                                 `((,builder2)
+                                   ;; two occurrences of MDRV:
+                                   (,mdrv)
+                                   (,mdrv "two")))))
+    (and (build-derivations %store (list (pk 'udrv udrv)))
+         (let ((p (derivation-path->output-path udrv)))
+           (and (valid-path? %store p)
+                (equal? '(one two) (call-with-input-file p read)))))))
+
 
 (define %coreutils
   (false-if-exception (nixpkgs-derivation "coreutils")))