;; it pulls in nsm, which then makes the :nowait t' tests fail unless
;; we disable the nsm, which we do by binding 'network-security-level'
+;; Check if the Internet seems to be working. Mainly to pacify
+;; Debian's CI system.
+(defvar internet-is-working
+ (progn
+ (require 'dns)
+ (dns-query "google.com")))
+
(ert-deftest make-local-unix-server ()
(skip-unless (featurep 'make-network-process '(:family local)))
(let* ((file (make-temp-name "/tmp/server-test"))
(ert-deftest connect-to-tls-ipv4-nowait ()
(skip-unless (executable-find "gnutls-serv"))
(skip-unless (gnutls-available-p))
+ (skip-unless internet-is-working)
(let ((server (make-tls-server 44331))
(times 0)
(network-security-level 'low)
(ert-deftest connect-to-tls-ipv6-nowait ()
(skip-unless (executable-find "gnutls-serv"))
(skip-unless (gnutls-available-p))
+ (skip-unless internet-is-working)
(skip-unless (not (eq system-type 'windows-nt)))
(skip-unless (featurep 'make-network-process '(:family ipv6)))
(let ((server (make-tls-server 44333))
(ert-deftest open-network-stream-tls-nowait ()
(skip-unless (executable-find "gnutls-serv"))
(skip-unless (gnutls-available-p))
+ (skip-unless internet-is-working)
(let ((server (make-tls-server 44335))
(times 0)
(network-security-level 'low)
(ert-deftest open-gnutls-stream-new-api-nowait ()
(skip-unless (executable-find "gnutls-serv"))
(skip-unless (gnutls-available-p))
+ (skip-unless internet-is-working)
(let ((server (make-tls-server 44668))
(times 0)
(network-security-level 'low)
(ert-deftest open-gnutls-stream-old-api-nowait ()
(skip-unless (executable-find "gnutls-serv"))
(skip-unless (gnutls-available-p))
+ (skip-unless internet-is-working)
(let ((server (make-tls-server 44669))
(times 0)
(network-security-level 'low)
invocation-directory))
:stop t))))
-;; All the following tests require working DNS, which appears not to
-;; be the case for hydra.nixos.org, so disable them there for now.
+;; The following tests require working DNS
;; This will need updating when IANA assign more IPv6 global ranges.
(defun ipv6-is-available ()
(= (logand (aref elt 0) #xe000) #x2000)))
(network-interface-list))))
+;; Check if the Internet seems to be working. Mainly to pacify
+;; Debian's CI system.
+(defvar internet-is-working
+ (progn
+ (require 'dns)
+ (dns-query "google.com")))
+
(ert-deftest lookup-family-specification ()
"`network-lookup-address-info' should only accept valid family symbols."
- (skip-unless (not (getenv "EMACS_HYDRA_CI")))
+ (skip-unless internet-is-working)
(with-timeout (60 (ert-fail "Test timed out"))
(should-error (network-lookup-address-info "localhost" 'both))
(should (network-lookup-address-info "localhost" 'ipv4))
(ert-deftest lookup-unicode-domains ()
"Unicode domains should fail."
- (skip-unless (not (getenv "EMACS_HYDRA_CI")))
+ (skip-unless internet-is-working)
(with-timeout (60 (ert-fail "Test timed out"))
(should-error (network-lookup-address-info "faß.de"))
(should (network-lookup-address-info (puny-encode-domain "faß.de")))))
(ert-deftest unibyte-domain-name ()
"Unibyte domain names should work."
- (skip-unless (not (getenv "EMACS_HYDRA_CI")))
+ (skip-unless internet-is-working)
(with-timeout (60 (ert-fail "Test timed out"))
(should (network-lookup-address-info (string-to-unibyte "google.com")))))
(ert-deftest lookup-google ()
"Check that we can look up google IP addresses."
- (skip-unless (not (getenv "EMACS_HYDRA_CI")))
+ (skip-unless internet-is-working)
(with-timeout (60 (ert-fail "Test timed out"))
(let ((addresses-both (network-lookup-address-info "google.com"))
(addresses-v4 (network-lookup-address-info "google.com" 'ipv4)))
(ert-deftest non-existent-lookup-failure ()
"Check that looking up non-existent domain returns nil."
- (skip-unless (not (getenv "EMACS_HYDRA_CI")))
+ (skip-unless internet-is-working)
(with-timeout (60 (ert-fail "Test timed out"))
(should (eq nil (network-lookup-address-info "emacs.invalid")))))
+;; End of tests requiring DNS
+
(defmacro process-tests--ignore-EMFILE (&rest body)
"Evaluate BODY, ignoring EMFILE errors."
(declare (indent 0) (debug t))