summary refs log tree commit diff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
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)