summary refs log tree commit diff
path: root/tests/store.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-02-02 12:25:34 +0100
committerLudovic Courtès <ludo@gnu.org>2015-02-02 12:46:36 +0100
commitabac874b22532a17a868443dc1f883ed483b0604 (patch)
tree3055f2e2d0cbe5e3ea208df81cb06e6bad7446ef /tests/store.scm
parente6c8839c180b88a9ef9e68af8acc3148099e286b (diff)
downloadguix-abac874b22532a17a868443dc1f883ed483b0604.tar.gz
store: Add 'build-things'.
* guix/store.scm (operation-id): Rename 'build-derivations' to
  'build-things', as per Nix commit 1aba0bf0.
  (build-derivations): Rename to...
  (build-things): ... this.  Keep 'build-derivations' as an alias.
  (build): New procedure.
* tests/store.scm ("build-things with output path",
  "substitute + build-things with output path"): New tests.
Diffstat (limited to 'tests/store.scm')
-rw-r--r--tests/store.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/store.scm b/tests/store.scm
index 73d64e468b..db7299fc70 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -306,6 +306,24 @@
            (null? (substitutable-paths s o))
            (null? (substitutable-path-info s o))))))
 
+(test-assert "build-things with output path"
+  (with-store s
+    (let* ((c   (random-text))                    ;contents of the output
+           (d   (build-expression->derivation
+                 s "substitute-me"
+                 `(call-with-output-file %output
+                    (lambda (p)
+                      (display ,c p)))
+                 #:guile-for-build
+                 (package-derivation s %bootstrap-guile (%current-system))))
+           (o   (derivation->output-path d)))
+      (set-build-options s #:use-substitutes? #f)
+
+      ;; Pass 'build-things' the output file name, O.  However, since there
+      ;; are no substitutes for O, it will just do nothing.
+      (build-things s (list o))
+      (not (valid-path? s o)))))
+
 (test-skip (if (getenv "GUIX_BINARY_SUBSTITUTE_URL") 0 1))
 
 (test-assert "substitute query"
@@ -350,6 +368,25 @@
              (build-derivations s (list d))
              (equal? c (call-with-input-file o get-string-all)))))))
 
+(test-assert "substitute + build-things with output path"
+  (with-store s
+    (let* ((c   (random-text))                    ;contents of the output
+           (d   (build-expression->derivation
+                 s "substitute-me"
+                 `(call-with-output-file %output
+                    (lambda (p)
+                      (exit 1)                    ;would actually fail
+                      (display ,c p)))
+                 #:guile-for-build
+                 (package-derivation s %bootstrap-guile (%current-system))))
+           (o   (derivation->output-path d)))
+      (with-derivation-substitute d c
+        (set-build-options s #:use-substitutes? #t)
+        (and (has-substitutes? s o)
+             (build-things s (list o))            ;give the output path
+             (valid-path? s o)
+             (equal? c (call-with-input-file o get-string-all)))))))
+
 (test-assert "substitute, corrupt output hash"
   ;; Tweak the substituter into installing a substitute whose hash doesn't
   ;; match the one announced in the narinfo.  The daemon must notice this and