diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-02-23 23:41:26 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-02-24 00:01:34 +0100 |
commit | 12d720fd1a9c43019f2d5afa051b45c7633b3ab0 (patch) | |
tree | b79f77aadfa44872d5c5aaf69ca99d6756f57c92 /guix/tests.scm | |
parent | 49685cae2bbe0384d4e0e46d38e9d0e1327e5225 (diff) | |
download | gnu-guix-12d720fd1a9c43019f2d5afa051b45c7633b3ab0.tar gnu-guix-12d720fd1a9c43019f2d5afa051b45c7633b3ab0.tar.gz |
tests: Factorize the network reachability test.
* guix/tests.scm (network-reachable?): New procedure.
* tests/builders.scm (network-reachable?): Remove.
Replace references to it with calls to the new 'network-reachable?'
procedure.
* tests/derivations.scm (%coreutils): Use 'network-reachable?' instead
of 'getaddrinfo'.
* tests/packages.scm: Likewise.
* tests/union.scm: Likewise.
Diffstat (limited to 'guix/tests.scm')
-rw-r--r-- | guix/tests.scm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/guix/tests.scm b/guix/tests.scm index 1171bb4dfb..d004a50a36 100644 --- a/guix/tests.scm +++ b/guix/tests.scm @@ -31,6 +31,7 @@ #:export (open-connection-for-tests random-text random-bytevector + network-reachable? mock %substitute-directory with-derivation-narinfo @@ -77,6 +78,10 @@ (loop (1+ i))) bv)))) +(define (network-reachable?) + "Return true if we can reach the Internet." + (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV))) + (define-syntax-rule (mock (module proc replacement) body ...) "Within BODY, replace the definition of PROC from MODULE with the definition given by REPLACEMENT." |