summary refs log tree commit diff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-23 14:55:44 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-23 15:02:26 +0200
commitbc73a84398fa54b0a11a80c749bf78eb0a58dbe6 (patch)
tree3e7b6670989ceb4f31464bad632c0332121d96a0 /tests/derivations.scm
parent12b6f6527e49c8c4191929a72b1692dbd9eb2440 (diff)
parent624d4e2e6ba402c374a340869306eec65a808a20 (diff)
downloadguix-bc73a84398fa54b0a11a80c749bf78eb0a58dbe6.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r--tests/derivations.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index cb7196e2a9..d8553b223e 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -367,6 +367,33 @@
            (and (eq? 'one (call-with-input-file one read))
                 (eq? 'two (call-with-input-file two read)))))))
 
+(test-assert "read-derivation vs. derivation"
+  ;; Make sure 'derivation' and 'read-derivation' return objects that are
+  ;; identical.
+  (let* ((sources (unfold (cut >= <> 10)
+                          (lambda (n)
+                            (add-text-to-store %store
+                                               (format #f "input~a" n)
+                                               (random-text)))
+                          1+
+                          0))
+         (inputs  (map (lambda (file)
+                         (derivation %store "derivation-input"
+                                     %bash '()
+                                     #:inputs `((,%bash) (,file))))
+                       sources))
+         (builder (add-text-to-store %store "builder.sh"
+                                     "echo one > $one ; echo two > $two"
+                                     '()))
+         (drv     (derivation %store "derivation"
+                              %bash `(,builder)
+                              #:inputs `((,%bash) (,builder)
+                                         ,@(map list (append sources inputs)))
+                              #:outputs '("two" "one")))
+         (drv*    (call-with-input-file (derivation-file-name drv)
+                    read-derivation)))
+    (equal? drv* drv)))
+
 (test-assert "multiple-output derivation, derivation-path->output-path"
   (let* ((builder    (add-text-to-store %store "builder.sh"
                                         "echo one > $out ; echo two > $second"