summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-08-04 17:25:36 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-08-04 17:25:36 +0200
commit99e9bdcd4105ac70f8f7ee06f2450cdbb15dbf3b (patch)
tree7b7bed98419f0d573490798f511471c1497256b1 /test
parentea9520a7a23dfd66de30b04d0c5ff878fecfd3d2 (diff)
downloademacs-99e9bdcd4105ac70f8f7ee06f2450cdbb15dbf3b.tar.gz
Make a network-stream test more robust
* test/lisp/net/network-stream-tests.el (network-test--resolve-system-name): New function. (echo-server-with-dns): Skip test if (system-name) doesn't look like it's going to resolve (bug#42535).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/net/network-stream-tests.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/lisp/net/network-stream-tests.el b/test/lisp/net/network-stream-tests.el
index 7a982548ae1..f44682e1edb 100644
--- a/test/lisp/net/network-stream-tests.el
+++ b/test/lisp/net/network-stream-tests.el
@@ -136,7 +136,20 @@
(t
))))
+(defun network-test--resolve-system-name ()
+ (cl-loop for address in (network-lookup-address-info (system-name))
+ when (or (and (= (length address) 5)
+ ;; IPv4 localhost addresses start with 127.
+ (= (elt address 0) 127))
+ (and (= (length address) 9)
+ ;; IPv6 localhost addresses start with 0.
+ (= (elt address 0) 0)))
+ return t))
+
(ert-deftest echo-server-with-dns ()
+ (unless (network-test--resolve-system-name)
+ (ert-skip "Can't test resolver for (system-name)"))
+
(let* ((server (make-server (system-name)))
(port (aref (process-contact server :local) 4))
(proc (make-network-process :name "foo"