summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-daemon.sh29
-rw-r--r--tests/store.scm27
2 files changed, 54 insertions, 2 deletions
diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh
index 7122eed0e6..fde49e25a2 100644
--- a/tests/guix-daemon.sh
+++ b/tests/guix-daemon.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2012, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -118,3 +118,30 @@ guile -c "
(clear-failed-paths store (list out))
(null? (query-failed-paths store)))))))
#:guile-for-build (%guile-for-build)) "
+
+kill "$daemon_pid"
+
+
+# Make sure the daemon's default 'build-cores' setting is honored.
+
+guix-daemon --listen="$socket" --disable-chroot --cores=42 &
+daemon_pid=$!
+
+GUIX_DAEMON_SOCKET="$socket" \
+guile -c '
+ (use-modules (guix) (gnu packages) (guix tests))
+
+ (with-store store
+ (let* ((build (add-text-to-store store "build.sh"
+ "echo $NIX_BUILD_CORES > $out"))
+ (bash (add-to-store store "bash" #t "sha256"
+ (search-bootstrap-binary "bash"
+ (%current-system))))
+ (drv (derivation store "the-thing" bash
+ `("-e" ,build)
+ #:inputs `((,bash) (,build))
+ #:env-vars `(("x" . ,(random-text))))))
+ (and (build-derivations store (list drv))
+ (exit
+ (= 42 (pk (call-with-input-file (derivation->output-path drv)
+ read)))))))'
diff --git a/tests/store.scm b/tests/store.scm
index 123ea8a787..983766d862 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -948,4 +948,29 @@
(string=? (derivation-file-name d)
(path-info-deriver (query-path-info %store o))))))
+(test-equal "build-cores"
+ (list 0 42)
+ (with-store store
+ (let* ((build (add-text-to-store store "build.sh"
+ "echo $NIX_BUILD_CORES > $out"))
+ (bash (add-to-store store "bash" #t "sha256"
+ (search-bootstrap-binary "bash"
+ (%current-system))))
+ (drv1 (derivation store "the-thing" bash
+ `("-e" ,build)
+ #:inputs `((,bash) (,build))
+ #:env-vars `(("x" . ,(random-text)))))
+ (drv2 (derivation store "the-thing" bash
+ `("-e" ,build)
+ #:inputs `((,bash) (,build))
+ #:env-vars `(("x" . ,(random-text))))))
+ (and (build-derivations store (list drv1))
+ (begin
+ (set-build-options store #:build-cores 42)
+ (build-derivations store (list drv2)))
+ (list (call-with-input-file (derivation->output-path drv1)
+ read)
+ (call-with-input-file (derivation->output-path drv2)
+ read))))))
+
(test-end "store")