aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-06-03 23:55:31 +0200
committerLudovic Courtès <ludo@gnu.org>2017-06-04 00:35:55 +0200
commit2ca9f51ec8125c0124362300853365a1a6c76ee5 (patch)
tree1b0fbd14a29dff3ea9fb077abb5483e7e9f0e4b8 /tests
parent20214f71157074406c19f4d29228eed79938b97d (diff)
downloadguix-2ca9f51ec8125c0124362300853365a1a6c76ee5.tar.gz
guix-2ca9f51ec8125c0124362300853365a1a6c76ee5.zip
daemon: Add '--timeout' and '--max-silent-time'.
* nix/nix-daemon/guix-daemon.cc (GUIX_OPT_TIMEOUT) (GUIX_OPT_MAX_SILENT_TIME): New macros. * nix/nix-daemon/guix-daemon.cc (options): Add '--timeout' and '--max-silent-time'. (parse_opt): Honor them. * tests/guix-daemon.sh: Add test. * doc/guix.texi (Invoking guix-daemon): Document the options. (Common Build Options): Properly describe default timeout/max-silent-time value. Add cross-ref to "Invoking guix-daemon".
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-daemon.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh
index fde49e25a2..9186ffd585 100644
--- a/tests/guix-daemon.sh
+++ b/tests/guix-daemon.sh
@@ -145,3 +145,39 @@ guile -c '
(exit
(= 42 (pk (call-with-input-file (derivation->output-path drv)
read)))))))'
+
+
+kill "$daemon_pid"
+
+# Make sure the daemon's default 'timeout' and 'max-silent-time' settings are
+# honored.
+
+client_code='
+ (use-modules (guix) (gnu packages) (guix tests) (srfi srfi-34))
+
+ (with-store store
+ (let* ((build (add-text-to-store store "build.sh"
+ "while true ; do : ; done"))
+ (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))))))
+ (exit (guard (c ((nix-protocol-error? c)
+ (->bool
+ (string-contains (pk (nix-protocol-error-message c))
+ "failed"))))
+ (build-derivations store (list drv))
+ #f))))'
+
+
+for option in --max-silent-time=1 --timeout=1
+do
+ guix-daemon --listen="$socket" --disable-chroot "$option" &
+ daemon_pid=$!
+
+ GUIX_DAEMON_SOCKET="$socket" guile -c "$client_code"
+ kill "$daemon_pid"
+done