summaryrefslogtreecommitdiff
path: root/tests/store.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-12-03 19:08:35 +0200
committerLudovic Courtès <ludo@gnu.org>2015-12-03 19:09:53 +0200
commit07e70f4846521c1fa5319b25f23eea171a03fccd (patch)
tree6afe1552ef452c53e4f786953b9716e4d25bc5cd /tests/store.scm
parentd203d3d4cb3d83beaadaaef6c279c3d84ac142f7 (diff)
downloadpatches-07e70f4846521c1fa5319b25f23eea171a03fccd.tar
patches-07e70f4846521c1fa5319b25f23eea171a03fccd.tar.gz
store: Add mode parameter to 'build-paths'.
* guix/store.scm (%protocol-version): Set minor to 15. (build-mode): New enumerate type. (build-things): Add 'mode' parameter; pass it to the RPC. * tests/store.scm ("build-things, check mode"): New check.
Diffstat (limited to 'tests/store.scm')
-rw-r--r--tests/store.scm35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/store.scm b/tests/store.scm
index 60d1085f99..72abf2c694 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -756,6 +756,41 @@
;; Delete the corrupt item to leave the store in a clean state.
(delete-paths s (list file)))))))
+(test-assert "build-things, check mode"
+ (with-store store
+ (call-with-temporary-output-file
+ (lambda (entropy entropy-port)
+ (write (random-text) entropy-port)
+ (force-output entropy-port)
+ (let* ((drv (build-expression->derivation
+ store "non-deterministic"
+ `(begin
+ (use-modules (rnrs io ports))
+ (let ((out (assoc-ref %outputs "out")))
+ (call-with-output-file out
+ (lambda (port)
+ (display (call-with-input-file ,entropy
+ get-string-all)
+ port)))
+ #t))
+ #:guile-for-build
+ (package-derivation store %bootstrap-guile (%current-system))))
+ (file (derivation->output-path drv)))
+ (and (build-things store (list (derivation-file-name drv)))
+ (begin
+ (write (random-text) entropy-port)
+ (force-output entropy-port)
+ (guard (c ((nix-protocol-error? c)
+ (pk 'determinism-exception c)
+ (and (not (zero? (nix-protocol-error-status c)))
+ (string-contains (nix-protocol-error-message c)
+ "deterministic"))))
+ ;; This one will produce a different result. Since we're in
+ ;; 'check' mode, this must fail.
+ (build-things store (list (derivation-file-name drv))
+ (build-mode check))
+ #f))))))))
+
(test-equal "store-lower"
"Lowered."
(let* ((add (store-lower text-file))