[PATCH] runtests: change local IP glob pattern from "127.0.0.1" to "$LOCALIP"

Jun Wu quark at fb.com
Sun Mar 26 22:58:02 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490583437 25200
#      Sun Mar 26 19:57:17 2017 -0700
# Node ID 82f3dbff59306181303549600cd7a307da667d05
# Parent  38ff33314869869535eb8f5c9cf4fa688847010e
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 82f3dbff5930
runtests: change local IP glob pattern from "127.0.0.1" to "$LOCALIP"

This is similar to what 348b2b9da703 does. Since 636cf3f7620d has changed
"127.0.0.1" to "$LOCALIP". The glob pattern needs update accordingly. It is
expected to fix tests running in some BSD jails.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -211,6 +211,6 @@ utestpats = [
   # warnings
   [
-    (r'^  (?!.*127\.0\.0\.1)[^*?/\n]* \(glob\)$',
-     "glob match with no glob string (?, *, /, and 127.0.0.1)"),
+    (r'^  (?!.*\$LOCALIP)[^*?/\n]* \(glob\)$',
+     "glob match with no glob string (?, *, /, and $LOCALIP)"),
   ]
 ]
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1035,5 +1035,5 @@ checkcodeglobpats = [
     # Not all platforms have 127.0.0.1 as loopback (though most do),
     # so we always glob that too.
-    re.compile(br'.*127.0.0.1.*$'),
+    re.compile(br'.*\$LOCALIP.*$'),
 ]
 
@@ -1343,5 +1343,5 @@ class TTest(Test):
                 return b'-glob'
             return True
-        el = el.replace(b'127.0.0.1', b'*')
+        el = el.replace(b'$LOCALIP', b'*')
         i, n = 0, len(el)
         res = b''
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -736,7 +736,9 @@ backslash on end of line with glob match
   $ rm -f test-glob-backslash.t
 
-Test globbing of 127.0.0.1
+Test globbing of local IP addresses
   $ echo 172.16.18.1
-  127.0.0.1 (glob)
+  $LOCALIP (glob)
+  $ echo dead:beef::1
+  $LOCALIP (glob)
 
 Test reusability for third party tools


More information about the Mercurial-devel mailing list