# HG changeset patch # User Matt Harbison # Date 2017-12-03 01:03:28 # Node ID 1b22d325089c9881dff3418ffc72d8c5c4ee24f5 # Parent a037b6647d8c3132433f7ec8f12580c75151ab3c 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. diff --git a/tests/common-pattern.py b/tests/common-pattern.py --- a/tests/common-pattern.py +++ b/tests/common-pattern.py @@ -61,6 +61,14 @@ substitutions = [ # 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(): diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t --- a/tests/test-http-bundle1.t +++ b/tests/test-http-bundle1.t @@ -26,15 +26,10 @@ parts that are not bundle1/bundle2 speci 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 diff --git a/tests/test-http.t b/tests/test-http.t --- a/tests/test-http.t +++ b/tests/test-http.t @@ -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 diff --git a/tests/test-https.t b/tests/test-https.t --- a/tests/test-https.t +++ b/tests/test-https.t @@ -34,15 +34,10 @@ cacert not found 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