summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-31 17:58:46 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-31 18:22:14 +0200
commit151afd84dc9bf8f13de79a689f7f163fba7254ec (patch)
treea20bebb620bc545f277cf2c6f709a2b881b1a3fb /tests
parent4078fa8f72fd109882f8b5e918cb6f7a9c1ed535 (diff)
downloadguix-151afd84dc9bf8f13de79a689f7f163fba7254ec.tar.gz
daemon: Substitute queries return immediately when substitutes are disabled.
Reported by Federico Beffa <beffa@ieee.org>
at <https://lists.gnu.org/archive/html/guix-devel/2016-05/msg00928.html>.

* nix/libstore/local-store.cc (LocalStore::querySubstitutablePaths)
(LocalStore::querySubstitutablePathInfos): Return when
'settings.useSubstitutes' is false.
* tests/store.scm ("references/substitutes missing reference info"):
Make sure to return #f on failure.
* tests/store.scm ("substitutable-path-info when substitutes are turned off"):
("substitutable-paths when substitutes are turned off"): New tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/store.scm29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/store.scm b/tests/store.scm
index 3c2c247561..38b8efce96 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -205,7 +205,8 @@
                                                         (%current-system))))
              (d  (derivation s "the-thing" b '("--help")
                              #:inputs `((,b)))))
-        (references/substitutes s (list (derivation->output-path d) b))))))
+        (references/substitutes s (list (derivation->output-path d) b))
+        #f))))
 
 (test-assert "references/substitutes with substitute info"
   (with-store s
@@ -231,6 +232,32 @@
                   (,t1)                           ;refs of T2
                   ()))))))                        ;refs of T1
 
+(test-equal "substitutable-path-info when substitutes are turned off"
+  '()
+  (with-store s
+    (set-build-options s #:use-substitutes? #f)
+    (let* ((b  (add-to-store s "bash" #t "sha256"
+                             (search-bootstrap-binary "bash"
+                                                      (%current-system))))
+           (d  (derivation s "the-thing" b '("--version")
+                           #:inputs `((,b))))
+           (o  (derivation->output-path d)))
+      (with-derivation-narinfo d
+        (substitutable-path-info s (list o))))))
+
+(test-equal "substitutable-paths when substitutes are turned off"
+  '()
+  (with-store s
+    (set-build-options s #:use-substitutes? #f)
+    (let* ((b  (add-to-store s "bash" #t "sha256"
+                             (search-bootstrap-binary "bash"
+                                                      (%current-system))))
+           (d  (derivation s "the-thing" b '("--version")
+                           #:inputs `((,b))))
+           (o  (derivation->output-path d)))
+      (with-derivation-narinfo d
+        (substitutable-paths s (list o))))))
+
 (test-assert "requisites"
   (let* ((t1 (add-text-to-store %store "random1"
                                 (random-text) '()))