summaryrefslogtreecommitdiff
path: root/guix/tests.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/tests.scm')
-rw-r--r--guix/tests.scm5
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."