[PATCH 10 of 10 ipv6 V2] runtests: add an IPv6 command line flag

Martin von Zweigbergk martinvonz at google.com
Fri Feb 17 17:56:24 EST 2017


On Fri, Feb 17, 2017 at 2:52 PM, Martin von Zweigbergk
<martinvonz at google.com> wrote:
> On Fri, Feb 17, 2017 at 10:51 AM, Jun Wu <quark at fb.com> wrote:
>> # HG changeset patch
>> # User Jun Wu <quark at fb.com>
>> # Date 1487323275 28800
>> #      Fri Feb 17 01:21:15 2017 -0800
>> # Node ID b1c5a6273c7b670337a48270045cc79e1cb39eb6
>> # Parent  cfcb22413b1958bb3c1ffe961b7471e8802abe59
>> # Available At https://bitbucket.org/quark-zju/hg-draft
>> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r b1c5a6273c7b
>> runtests: add an IPv6 command line flag
>>
>> Now we have all IPv6 related issues fixed, add a command line flag so people
>> could actually run tests with IPv6.
>>
>> diff --git a/tests/run-tests.py b/tests/run-tests.py
>> --- a/tests/run-tests.py
>> +++ b/tests/run-tests.py
>> @@ -138,6 +138,6 @@ def checksocketfamily(name, port=20058):
>>          return False
>>
>> -# IPv6 is used if IPv4 is not available and IPv6 is available.
>> -useipv6 = (not checksocketfamily('AF_INET')) and checksocketfamily('AF_INET6')
>> +# useipv6 will be set by parseargs
>> +useipv6 = None
>>
>>  def checkportisavailable(port):
>> @@ -303,4 +303,6 @@ def getparser():
>>      parser.add_option("--with-chg", metavar="CHG",
>>                        help="use specified chg wrapper in place of hg")
>> +    parser.add_option("--ipv6", action="store_true",
>> +                      help="prefer IPv6 to IPv4 for network related tests")
>>      parser.add_option("-3", "--py3k-warnings", action="store_true",
>>          help="enable Py3k warnings on Python 2.6+")
>> @@ -372,4 +374,13 @@ def parseargs(args, parser):
>>                       '(use --with-chg instead)')
>>
>> +    preferred = ['AF_INET', 'AF_INET6']
>
> Unused. Should I drop in flight?

I ended up doing that. This is now queued, thanks.

>
>> +    global useipv6
>> +    if options.ipv6:
>> +        useipv6 = checksocketfamily('AF_INET6')
>> +    else:
>> +        # only use IPv6 if IPv4 is unavailable and IPv6 is available
>> +        useipv6 = ((not checksocketfamily('AF_INET'))
>> +                   and checksocketfamily('AF_INET6'))
>> +
>>      options.anycoverage = options.cover or options.annotate or options.htmlcov
>>      if options.anycoverage:
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list