[PATCH 4 of 5] tests: add a substitution for ECONNRESET/WSAECONNRESET messages

Matt Harbison mharbison72 at gmail.com
Sun Dec 3 01:54:57 EST 2017


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1512263458 18000
#      Sat Dec 02 20:10:58 2017 -0500
# Node ID 507dc98c238c04f1a6d1cc6c71ac60676a7d24a8
# Parent  ee5f78d85b5f398ae6a1af6cdf7f9565b6910d40
tests: add a substitution for ECONNRESET/WSAECONNRESET messages

diff --git a/tests/common-pattern.py b/tests/common-pattern.py
--- a/tests/common-pattern.py
+++ b/tests/common-pattern.py
@@ -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():
diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t
--- a/tests/test-http-bad-server.t
+++ b/tests/test-http-bad-server.t
@@ -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.


More information about the Mercurial-devel mailing list