changeset 35233:1b22d325089c

tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages I suspect some more of these are globbed out, so this is a bit of future proofing.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 02 Dec 2017 20:03:28 -0500
parents a037b6647d8c
children f0445eea9b93
files tests/common-pattern.py tests/test-http-bundle1.t tests/test-http.t tests/test-https.t
diffstat 4 files changed, 14 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/tests/common-pattern.py	Sat Dec 02 20:10:58 2017 -0500
+++ b/tests/common-pattern.py	Sat Dec 02 20:03:28 2017 -0500
@@ -61,6 +61,14 @@
         # FormatMessage(WSAECONNRESET)
         br'An existing connection was forcibly closed by the remote host',
     ),
+    br'$EADDRINUSE$': (
+        # strerror()
+        br'Address already in use',
+
+        # FormatMessage(WSAEADDRINUSE)
+        br'Only one usage of each socket address'
+        br' \(protocol/network address/port\) is normally permitted',
+    ),
 }
 
 for replace, msgs in _errors.items():
--- a/tests/test-http-bundle1.t	Sat Dec 02 20:10:58 2017 -0500
+++ b/tests/test-http-bundle1.t	Sat Dec 02 20:03:28 2017 -0500
@@ -26,15 +26,10 @@
 
 Test server address cannot be reused
 
-#if windows
   $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at 'localhost:$HGPORT1': * (glob)
+  abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
   [255]
-#else
-  $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at 'localhost:$HGPORT1': Address already in use
-  [255]
-#endif
+
   $ cd ..
   $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
 
--- a/tests/test-http.t	Sat Dec 02 20:10:58 2017 -0500
+++ b/tests/test-http.t	Sat Dec 02 20:03:28 2017 -0500
@@ -17,15 +17,10 @@
 
 Test server address cannot be reused
 
-#if windows
   $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at 'localhost:$HGPORT1': * (glob)
+  abort: cannot start server at 'localhost:$HGPORT1': $EADDRINUSE$
   [255]
-#else
-  $ hg serve -p $HGPORT1 2>&1
-  abort: cannot start server at 'localhost:$HGPORT1': Address already in use
-  [255]
-#endif
+
   $ cd ..
   $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
 
--- a/tests/test-https.t	Sat Dec 02 20:10:58 2017 -0500
+++ b/tests/test-https.t	Sat Dec 02 20:03:28 2017 -0500
@@ -34,15 +34,10 @@
 
 Test server address cannot be reused
 
-#if windows
   $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
-  abort: cannot start server at 'localhost:$HGPORT': * (glob)
+  abort: cannot start server at 'localhost:$HGPORT': $EADDRINUSE$
   [255]
-#else
-  $ hg serve -p $HGPORT --certificate=$PRIV 2>&1
-  abort: cannot start server at 'localhost:$HGPORT': Address already in use
-  [255]
-#endif
+
   $ cd ..
 
 Our test cert is not signed by a trusted CA. It should fail to verify if