summary refs log tree commit diff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-12-09 10:30:03 +0100
committerLudovic Courtès <ludo@gnu.org>2015-12-09 14:29:41 +0100
commit58c08df0544bc39b3b5a8f6638f776159b6b8d8e (patch)
tree5f172e8bd62b708822babe11944585616c0e06be /tests/derivations.scm
parentcc9553562c0b719c40083503795845aa0cc3a6f8 (diff)
downloadguix-58c08df0544bc39b3b5a8f6638f776159b6b8d8e.tar.gz
derivations: Determine what's built in 'check' mode.
* guix/derivations.scm (substitution-oracle): Add #:mode parameter and
honor it.
(derivation-prerequisites-to-build): Likewise.
[derivation-built?]: Take it into account.
* guix/ui.scm (show-what-to-build): Add #:mode parameter.  Pass it to
'substitute-oracle' and 'derivations-prerequisites-to-build'.
* tests/derivations.scm ("derivation-prerequisites-to-build in 'check'
mode"): 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 9fc96c71ae..1bbc93fe5c 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -670,6 +670,26 @@
                  (((? string? item))
                   (string=? item (derivation->output-path drv))))))))))
 
+(test-assert "derivation-prerequisites-to-build in 'check' mode"
+  (with-store store
+    (let* ((dep (build-expression->derivation store "dep"
+                                              `(begin ,(random-text)
+                                                      (mkdir %output))))
+           (drv (build-expression->derivation store "to-check"
+                                              '(mkdir %output)
+                                              #:inputs `(("dep" ,dep)))))
+      (build-derivations store (list drv))
+      (delete-paths store (list (derivation->output-path dep)))
+
+      ;; In 'check' mode, DEP must be rebuilt.
+      (and (null? (derivation-prerequisites-to-build store drv))
+           (match (derivation-prerequisites-to-build store drv
+                                                     #:mode (build-mode
+                                                             check))
+             ((input)
+              (string=? (derivation-input-path input)
+                        (derivation-file-name dep))))))))
+
 (test-assert "build-expression->derivation with expression returning #f"
   (let* ((builder  '(begin
                       (mkdir %output)