Patchwork runtests: catch EPROTONOSUPPORT in checkportisavailable

login
register
mail settings
Submitter Jun Wu
Date Feb. 10, 2017, 12:18 p.m.
Message ID <a9b0b592aad5483f1229.1486729109@localhost.localdomain>
Download mbox | patch
Permalink /patch/18392/
State Accepted
Headers show

Comments

Jun Wu - Feb. 10, 2017, 12:18 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1486728546 28800
#      Fri Feb 10 04:09:06 2017 -0800
# Node ID a9b0b592aad5483f1229d2e71dbd70c32f560814
# Parent  dd14ece7cb20d8f3c764b17d2edc9ee646a27f2f
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r a9b0b592aad5
runtests: catch EPROTONOSUPPORT in checkportisavailable

This is a follow-up of "runtests: check ports on IPv6 address". On some
platforms, "socket.AF_INET6" exists while that does not necessarily mean the
platform support IPv6 - when initializing a socket using "socket.socket", it
could fail with EPROTONOSUPPORT. So treat that as "Port unavailable".
Yuya Nishihara - Feb. 10, 2017, 1:55 p.m.
On Fri, 10 Feb 2017 04:18:29 -0800, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1486728546 28800
> #      Fri Feb 10 04:09:06 2017 -0800
> # Node ID a9b0b592aad5483f1229d2e71dbd70c32f560814
> # Parent  dd14ece7cb20d8f3c764b17d2edc9ee646a27f2f
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r a9b0b592aad5
> runtests: catch EPROTONOSUPPORT in checkportisavailable

Looks good. Queued, thanks.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -125,5 +125,6 @@  def checkportisavailable(port):
             return True
         except socket.error as exc:
-            if exc.errno not in (errno.EADDRINUSE, errno.EADDRNOTAVAIL):
+            if exc.errno not in (errno.EADDRINUSE, errno.EADDRNOTAVAIL,
+                                 errno.EPROTONOSUPPORT):
                 raise
     return False