changeset 31009:161ab32b44a1

runtests: set web.address to localhost Previously, "hg serve" will listen on "", which is not clear which interface it will actually listen on - it could listen on all interfaces (ex. 0.0.0.0 on IPv4). The run-tests.py script only checks "localhost" for available ports. So let's make it the same for "hg serve" by explicitly setting "web.address" to "localhost". This resolves some IPv6 EADDRINUSE errors.
author Jun Wu <quark@fb.com>
date Thu, 16 Feb 2017 00:13:29 -0800
parents 636cf3f7620d
children 09ec648cd2a9
files tests/run-tests.py tests/test-basic.t tests/test-commandserver.t tests/test-http-bundle1.t tests/test-http.t tests/test-https.t
diffstat 6 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Thu Feb 16 09:38:52 2017 -0800
+++ b/tests/run-tests.py	Thu Feb 16 00:13:29 2017 -0800
@@ -933,6 +933,8 @@
         hgrc.write(b'[largefiles]\n')
         hgrc.write(b'usercache = %s\n' %
                    (os.path.join(self._testtmp, b'.cache/largefiles')))
+        hgrc.write(b'[web]\n')
+        hgrc.write(b'address = localhost\n')
 
         for opt in self._extraconfigopts:
             section, key = opt.split('.', 1)
--- a/tests/test-basic.t	Thu Feb 16 09:38:52 2017 -0800
+++ b/tests/test-basic.t	Thu Feb 16 00:13:29 2017 -0800
@@ -11,6 +11,7 @@
   ui.interactive=False
   ui.mergemarkers=detailed
   ui.promptecho=True
+  web.address=localhost
   web.ipv6=True (?)
   $ hg init t
   $ cd t
--- a/tests/test-commandserver.t	Thu Feb 16 09:38:52 2017 -0800
+++ b/tests/test-commandserver.t	Thu Feb 16 00:13:29 2017 -0800
@@ -199,6 +199,7 @@
   ui.usehttp2=true (?)
   ui.foo=bar
   ui.nontty=true
+  web.address=localhost
   web.ipv6=True (?)
   *** runcommand init foo
   *** runcommand -R foo showconfig ui defaults
--- a/tests/test-http-bundle1.t	Thu Feb 16 09:38:52 2017 -0800
+++ b/tests/test-http-bundle1.t	Thu Feb 16 00:13:29 2017 -0800
@@ -28,11 +28,11 @@
 
 #if windows
   $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at ':$HGPORT1': * (glob)
+  abort: cannot start server at 'localhost:$HGPORT1': * (glob)
   [255]
 #else
   $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at ':$HGPORT1': Address already in use
+  abort: cannot start server at 'localhost:$HGPORT1': Address already in use
   [255]
 #endif
   $ cd ..
--- a/tests/test-http.t	Thu Feb 16 09:38:52 2017 -0800
+++ b/tests/test-http.t	Thu Feb 16 00:13:29 2017 -0800
@@ -23,7 +23,7 @@
   [255]
 #else
   $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at ':$HGPORT1': Address already in use
+  abort: cannot start server at 'localhost:$HGPORT1': Address already in use
   [255]
 #endif
   $ cd ..
--- a/tests/test-https.t	Thu Feb 16 09:38:52 2017 -0800
+++ b/tests/test-https.t	Thu Feb 16 00:13:29 2017 -0800
@@ -36,11 +36,11 @@
 
 #if windows
   $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
-  abort: cannot start server at ':$HGPORT':
+  abort: cannot start server at 'localhost:$HGPORT':
   [255]
 #else
   $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
-  abort: cannot start server at ':$HGPORT': Address already in use
+  abort: cannot start server at 'localhost:$HGPORT': Address already in use
   [255]
 #endif
   $ cd ..