tests: add a substitution for ECONNRESET/WSAECONNRESET messages
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 02 Dec 2017 20:10:58 -0500
changeset 35232 a037b6647d8c
parent 35231 b33d4cf38666
child 35233 1b22d325089c
tests: add a substitution for ECONNRESET/WSAECONNRESET messages
tests/common-pattern.py
tests/test-http-bad-server.t
--- a/tests/common-pattern.py	Sat Dec 02 20:38:23 2017 -0500
+++ b/tests/common-pattern.py	Sat Dec 02 20:10:58 2017 -0500
@@ -54,6 +54,13 @@
         # FormatMessage(ERROR_PATH_NOT_FOUND)
         br'The system cannot find the path specified',
     ),
+    br'$ECONNRESET$': (
+        # strerror()
+        br'Connection reset by peer',
+
+        # FormatMessage(WSAECONNRESET)
+        br'An existing connection was forcibly closed by the remote host',
+    ),
 }
 
 for replace, msgs in _errors.items():
--- a/tests/test-http-bad-server.t	Sat Dec 02 20:38:23 2017 -0500
+++ b/tests/test-http-bad-server.t	Sat Dec 02 20:10:58 2017 -0500
@@ -36,8 +36,7 @@
   $ cat hg.pid > $DAEMON_PIDS
 
   $ hg clone http://localhost:$HGPORT/ clone
-  abort: error: Connection reset by peer (no-windows !)
-  abort: error: An existing connection was forcibly closed by the remote host (windows !)
+  abort: error: $ECONNRESET$
   [255]
 
 (The server exits on its own, but there is a race between that and starting a new server.
@@ -54,8 +53,7 @@
 error: '' on FreeBSD and OS X.
 What we ideally want are:
 
-abort: error: Connection reset by peer (no-windows !)
-abort: error: An existing connection was forcibly closed by the remote host (windows !)
+abort: error: $ECONNRESET$
 
 The flakiness in this output was observable easily with
 --runs-per-test=20 on macOS 10.12 during the freeze for 4.2.