diff options
author | Robert Pluim <rpluim@gmail.com> | 2021-01-12 18:50:38 +0100 |
---|---|---|
committer | Robert Pluim <rpluim@gmail.com> | 2021-01-12 18:53:48 +0100 |
commit | 0f6c083251ccc727d0b18a62cdd99901aa692c78 (patch) | |
tree | a9fd5b578966b8478615d6a6ab9970c839b7c24c /test/lisp/net/nsm-tests.el | |
parent | 6dc4fc7d621008086388dae48f6794f7d69edff9 (diff) | |
download | emacs-0f6c083251ccc727d0b18a62cdd99901aa692c78.tar.gz emacs-0f6c083251ccc727d0b18a62cdd99901aa692c78.tar.bz2 emacs-0f6c083251ccc727d0b18a62cdd99901aa692c78.zip |
Only run IPv6 tests if we have an IPv6 address
* test/src/process-tests.el (ipv6-is-available): New function for
checking whether we have a globally routable IPv6 prefix assigned.
(lookup-family-specification): Use 'ipv6-is-available' to check for
IPv6. Use 'localhost' instead of 'google.com' to test
'network-lookup-address-info' API.
(lookup-google): Use 'ipv6-is-available' to check for
IPv6.
* test/lisp/net/nsm-tests.el (nsm-ipv6-is-available): Rename to
'ipv6-is-available', make identical to the one in
test/src/process-tests.el.
Diffstat (limited to 'test/lisp/net/nsm-tests.el')
-rw-r--r-- | test/lisp/net/nsm-tests.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/lisp/net/nsm-tests.el b/test/lisp/net/nsm-tests.el index 88c30c20395..ff453319b37 100644 --- a/test/lisp/net/nsm-tests.el +++ b/test/lisp/net/nsm-tests.el @@ -49,15 +49,17 @@ (should (eq nil (nsm-should-check "127.0.0.1"))) (should (eq nil (nsm-should-check "localhost")))))) -(defun nsm-ipv6-is-available () +;; This will need updating when IANA assign more IPv6 global ranges. +(defun ipv6-is-available () (and (featurep 'make-network-process '(:family ipv6)) (cl-rassoc-if (lambda (elt) - (eq 9 (length elt))) + (and (eq 9 (length elt)) + (= (logand (aref elt 0) #xe000) #x2000))) (network-interface-list)))) (ert-deftest nsm-check-local-subnet-ipv6 () - (skip-unless (nsm-ipv6-is-available)) + (skip-unless (ipv6-is-available)) (let ((local-ip '[123 456 789 11 172 26 128 160 0]) (mask '[255 255 255 255 255 255 255 0 0]) |