guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/04: derivations: Add test in keep-going mode.


From: Ludovic Courtès
Subject: 01/04: derivations: Add test in keep-going mode.
Date: Tue, 19 Jan 2016 22:47:48 +0000

civodul pushed a commit to branch master
in repository guix.

commit 0e510971c3f6e5203803f14c40b89fe37d3d3f53
Author: Ludovic Courtès <address@hidden>
Date:   Tue Jan 19 21:38:44 2016 +0100

    derivations: Add test in keep-going mode.
    
    * tests/derivations.scm ("derivation fails but keep going"): New test.
---
 tests/derivations.scm |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/tests/derivations.scm b/tests/derivations.scm
index 64cc8a9..db96e26 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -151,6 +151,33 @@
          ;; the contents.
          (valid-path? %store (derivation->output-path drv)))))
 
+(test-assert "derivation fails but keep going"
+  ;; In keep-going mode, 'build-derivations' should fail because of D1, but it
+  ;; must return only after D2 has succeeded.
+  (with-store store
+    (let* ((d1 (derivation %store "fails"
+                           %bash `("-c" "false")
+                           #:inputs `((,%bash))))
+           (d2 (build-expression->derivation %store "sleep-then-succeed"
+                                             `(begin
+                                                ,(random-text)
+                                                ;; XXX: Hopefully that's long
+                                                ;; enough that D1 has already
+                                                ;; failed.
+                                                (sleep 2)
+                                                (mkdir %output)))))
+      (set-build-options %store
+                         #:use-substitutes? #f
+                         #:keep-going? #t)
+      (guard (c ((nix-protocol-error? c)
+                 (and (= 100 (nix-protocol-error-status c))
+                      (string-contains (nix-protocol-error-message c)
+                                       (derivation-file-name d1))
+                      (not (valid-path? %store (derivation->output-path d1)))
+                      (valid-path? %store (derivation->output-path d2)))))
+        (build-derivations %store (list d1 d2))
+        #f))))
+
 (test-assert "identical files are deduplicated"
   (let* ((build1  (add-text-to-store %store "one.sh"
                                      "echo hello, world > \"$out\"\n"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]