mirror of
https://codeberg.org/guix/guix.git
synced 2026-01-25 03:55:08 -06:00
tests: Increase test timeout and honor ‘GUIX_TESTS_BUILD_TIMEOUT’.
Rigid build time limits let some unit tests fail on slow hardware. Set default timeout to 5 minutes and make it configurable via `GUIX_TESTS_BUILD_TIMEOUT` environment variable. * guix/tests.scm (%tests-build-timeout): New variable. (open-connection-for-tests, call-with-external-store): Use it. * tests/guix-environment-container.sh, tests/guix-home.sh, tests/guix-pack-localstatedir.sh, tests/guix-pack-relocatable.sh: Use it to define ‘GUIX_BUILD_OPTIONS’. Change-Id: Iab63c2dcf4a3ad311a0cf2f39d7ea2ec158ddbb4 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
f3b0398cf2
commit
590eb9ef40
5 changed files with 15 additions and 7 deletions
|
|
@ -52,6 +52,7 @@
|
|||
search-bootstrap-binary
|
||||
|
||||
mock
|
||||
%tests-build-timeout
|
||||
%test-substitute-urls
|
||||
test-assertm
|
||||
test-equalm
|
||||
|
|
@ -72,6 +73,13 @@
|
|||
;;;
|
||||
;;; Code:
|
||||
|
||||
(define %tests-build-timeout
|
||||
;; Timeout limit for guix unit tests (default: 5 minutes)
|
||||
(let ((default (* 5 60)))
|
||||
(match (getenv "GUIX_TESTS_BUILD_TIMEOUT")
|
||||
(#f default)
|
||||
(str (or (string->number str) default)))))
|
||||
|
||||
(define %test-substitute-urls
|
||||
;; URLs where to look for substitutes during tests.
|
||||
(make-parameter
|
||||
|
|
@ -86,11 +94,11 @@
|
|||
#f))
|
||||
(let ((store (open-connection uri)))
|
||||
;; Make sure we build everything by ourselves. When we build something,
|
||||
;; it should take at most 3 minutes.
|
||||
;; it should take at most a few minutes.
|
||||
(set-build-options store
|
||||
#:use-substitutes? #f
|
||||
#:substitute-urls (%test-substitute-urls)
|
||||
#:timeout (* 3 60))
|
||||
#:timeout %tests-build-timeout)
|
||||
|
||||
;; Use the bootstrap Guile when running tests, so we don't end up
|
||||
;; building everything in the temporary test store.
|
||||
|
|
@ -151,7 +159,7 @@ no external store to talk to."
|
|||
(lambda ()
|
||||
(when store
|
||||
;; Make sure we don't end up rebuilding the world for those tests.
|
||||
(set-build-options store #:timeout (* 3 60)))
|
||||
(set-build-options store #:timeout %tests-build-timeout))
|
||||
(proc store))
|
||||
(lambda ()
|
||||
(when store-variable
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ storedir="`guile -c '(use-modules (guix config))(display %storedir)'`"
|
|||
localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`"
|
||||
NIX_STORE_DIR="$storedir"
|
||||
GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket"
|
||||
GUIX_BUILD_OPTIONS="--timeout=180" # set an upper limit
|
||||
GUIX_BUILD_OPTIONS="--timeout=`guile -c '(use-modules (guix tests))(display %tests-build-timeout)'`"
|
||||
export NIX_STORE_DIR GUIX_DAEMON_SOCKET GUIX_BUILD_OPTIONS
|
||||
|
||||
if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connection)))'
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ container_supported ()
|
|||
localstatedir="$(guile -c '(use-modules (guix config))(display %localstatedir)')"
|
||||
NIX_STORE_DIR="$(guile -c '(use-modules (guix config))(display %storedir)')"
|
||||
GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket"
|
||||
GUIX_BUILD_OPTIONS="--timeout=180" # set an upper limit
|
||||
GUIX_BUILD_OPTIONS="--timeout=`guile -c '(use-modules (guix tests))(display %tests-build-timeout)'`"
|
||||
export NIX_STORE_DIR GUIX_DAEMON_SOCKET GUIX_BUILD_OPTIONS
|
||||
|
||||
# Run tests only when a "real" daemon is available.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ storedir="`guile -c '(use-modules (guix config))(display %storedir)'`"
|
|||
localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`"
|
||||
NIX_STORE_DIR="$storedir"
|
||||
GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket"
|
||||
GUIX_BUILD_OPTIONS="--timeout=180" # set an upper limit
|
||||
GUIX_BUILD_OPTIONS="--timeout=`guile -c '(use-modules (guix tests))(display %tests-build-timeout)'`"
|
||||
export NIX_STORE_DIR GUIX_DAEMON_SOCKET GUIX_BUILD_OPTIONS
|
||||
|
||||
if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connection)))'
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ storedir="`guile -c '(use-modules (guix config))(display %storedir)'`"
|
|||
localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`"
|
||||
NIX_STORE_DIR="$storedir"
|
||||
GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket"
|
||||
GUIX_BUILD_OPTIONS="--timeout=180"
|
||||
GUIX_BUILD_OPTIONS="--timeout=`guile -c '(use-modules (guix tests))(display %tests-build-timeout)'`"
|
||||
export NIX_STORE_DIR GUIX_DAEMON_SOCKET GUIX_BUILD_OPTIONS
|
||||
|
||||
if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connection)))'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue