summary refs log tree commit diff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-03-09 23:01:18 +0100
committerLudovic Courtès <ludo@gnu.org>2014-03-09 23:01:18 +0100
commit6c20d1d0c3822c0332f3cca963121365133e6412 (patch)
treefdb2c7c0d1c68376541e2d507bf98a72031fa9c1 /tests/derivations.scm
parent02c86a5e365f59fb09c32cfaaef2c02db17e8770 (diff)
downloadguix-6c20d1d0c3822c0332f3cca963121365133e6412.tar.gz
store: Add #:timeout build option.
* guix/serialization.scm (write-string-pairs): New procedure.
* guix/store.scm (write-arg): Add 'string-pairs' case.
  (set-build-options): Add 'timeout' keyword parameter.  Honor it.
* tests/derivations.scm ("build-expression->derivation and timeout"):
  New test.
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r--tests/derivations.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index f31b00b8a2..e87662a198 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -446,6 +446,20 @@
       (build-derivations store (list drv))
       #f)))
 
+(test-assert "build-expression->derivation and timeout"
+  (let* ((store      (let ((s (open-connection)))
+                       (set-build-options s #:timeout 1)
+                       s))
+         (builder    '(begin (sleep 100) (mkdir %output) #t))
+         (drv        (build-expression->derivation store "slow" builder))
+         (out-path   (derivation->output-path drv)))
+    (guard (c ((nix-protocol-error? c)
+               (and (string-contains (nix-protocol-error-message c)
+                                     "failed")
+                    (not (valid-path? store out-path)))))
+      (build-derivations store (list drv))
+      #f)))
+
 (test-assert "build-expression->derivation and derivation-prerequisites-to-build"
   (let ((drv (build-expression->derivation %store "fail" #f)))
     ;; The only direct dependency is (%guile-for-build) and it's already