Patchwork D12371: tests: support another error case when detecting ipv4/ipv6 support

login
register
mail settings
Submitter phabricator
Date March 10, 2022, 5:30 a.m.
Message ID <differential-rev-PHID-DREV-5vzdumooabrxhrfvvgpn-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50713/
State New
Headers show

Comments

phabricator - March 10, 2022, 5:30 a.m.
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I encountered this on Linux in a VM environment with a rather strange networking
  setup (both on the host and in the VM).

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12371

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -238,10 +238,11 @@ 
         s.bind(('localhost', port))
         s.close()
         return True
-    except socket.error as exc:
+    except (socket.error, OSError) as exc:
         if exc.errno == errno.EADDRINUSE:
             return True
-        elif exc.errno in (errno.EADDRNOTAVAIL, errno.EPROTONOSUPPORT):
+        elif exc.errno in (errno.EADDRNOTAVAIL, errno.EPROTONOSUPPORT,
+                           errno.EAFNOSUPPORT):
             return False
         else:
             raise