diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2017-06-03 23:55:31 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2017-06-04 00:35:55 +0200 |
| commit | 2ca9f51ec8125c0124362300853365a1a6c76ee5 (patch) | |
| tree | 1b0fbd14a29dff3ea9fb077abb5483e7e9f0e4b8 /tests/guix-daemon.sh | |
| parent | 20214f71157074406c19f4d29228eed79938b97d (diff) | |
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/guix-daemon.sh')
| -rw-r--r-- | tests/guix-daemon.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/guix-daemon.sh b/tests/guix-daemon.sh index fde49e25a2f..9186ffd5858 100644 --- a/tests/guix-daemon.sh +++ b/tests/guix-daemon.sh | |||
| @@ -145,3 +145,39 @@ guile -c ' | |||
| 145 | (exit | 145 | (exit |
| 146 | (= 42 (pk (call-with-input-file (derivation->output-path drv) | 146 | (= 42 (pk (call-with-input-file (derivation->output-path drv) |
| 147 | read)))))))' | 147 | read)))))))' |
| 148 | |||
| 149 | |||
| 150 | kill "$daemon_pid" | ||
| 151 | |||
| 152 | # Make sure the daemon's default 'timeout' and 'max-silent-time' settings are | ||
| 153 | # honored. | ||
| 154 | |||
| 155 | client_code=' | ||
| 156 | (use-modules (guix) (gnu packages) (guix tests) (srfi srfi-34)) | ||
| 157 | |||
| 158 | (with-store store | ||
| 159 | (let* ((build (add-text-to-store store "build.sh" | ||
| 160 | "while true ; do : ; done")) | ||
| 161 | (bash (add-to-store store "bash" #t "sha256" | ||
| 162 | (search-bootstrap-binary "bash" | ||
| 163 | (%current-system)))) | ||
| 164 | (drv (derivation store "the-thing" bash | ||
| 165 | `("-e" ,build) | ||
| 166 | #:inputs `((,bash) (,build)) | ||
| 167 | #:env-vars `(("x" . ,(random-text)))))) | ||
| 168 | (exit (guard (c ((nix-protocol-error? c) | ||
| 169 | (->bool | ||
| 170 | (string-contains (pk (nix-protocol-error-message c)) | ||
| 171 | "failed")))) | ||
| 172 | (build-derivations store (list drv)) | ||
| 173 | #f))))' | ||
| 174 | |||
| 175 | |||
| 176 | for option in --max-silent-time=1 --timeout=1 | ||
| 177 | do | ||
| 178 | guix-daemon --listen="$socket" --disable-chroot "$option" & | ||
| 179 | daemon_pid=$! | ||
| 180 | |||
| 181 | GUIX_DAEMON_SOCKET="$socket" guile -c "$client_code" | ||
| 182 | kill "$daemon_pid" | ||
| 183 | done | ||
