[PATCH 3 of 4] tests: tolerate differences between Linux and Windows error strings

Matt Harbison matt_harbison at yahoo.com
Mon Nov 9 16:30:31 CST 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1447092755 18000
#      Mon Nov 09 13:12:35 2015 -0500
# Node ID 6b336cba3a589e091429c89e98ee83b89b5ea842
# Parent  925418e8df71ebdf1bd48447c71c2963ea744cd3
tests: tolerate differences between Linux and Windows error strings

These are related to differences in how missing files and network connection
failures are displayed.  I opted to combine the strings in one line instead of
using '#if windows' blocks around entire commands in order to avoid future
changes being accidentally missed in the Windows sections.  Globbing away the
entire output seemed wrong, as it could mask other failures.

The raw messages involved are:

      Linux                               Windows

  "* not known"               <-> "getaddrinfo failed"
  "Connection refused"        <-> "No connection could be made because the
                                   target machine actively refused it"
  "No such file or directory" <-> "The system cannot find the file specified"

Issue 4941 indicates that NetBSD has yet another string for "* not known".

Also, the histedit test shows that the missing file is printed first on Windows,
last on Linux.  That is controlled in windows.py:posixfile if we care to change
it.

diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -80,7 +80,7 @@
   $ echo 'http://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest
   $ hg clone http://localhost:$HGPORT 404-url
   applying clone bundle from http://does.not.exist/bundle.hg
-  error fetching bundle: * not known (glob)
+  error fetching bundle: (.* not known|getaddrinfo failed) (re)
   abort: error applying bundle
   (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false")
   [255]
@@ -90,7 +90,7 @@
   $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest
   $ hg clone http://localhost:$HGPORT server-not-runner
   applying clone bundle from http://localhost:$HGPORT1/bundle.hg
-  error fetching bundle: Connection refused
+  error fetching bundle: * refused* (glob)
   abort: error applying bundle
   (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false")
   [255]
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -339,7 +339,7 @@
   $ mv ../corrupt-histedit .hg/histedit-state
   $ hg histedit --abort
   warning: encountered an exception during histedit --abort; the repository may not have been completely cleaned up
-  abort: No such file or directory: * (glob)
+  abort: .*(No such file or directory:|The system cannot find the file specified).* (re)
   [255]
 Histedit state has been exited
   $ hg summary -q
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1152,7 +1152,7 @@
   $ rm .hg/unshelverebasestate
   $ hg unshelve --abort
   unshelve of 'default' aborted
-  abort: No such file or directory
+  abort: (No such file or directory|The system cannot find the file specified) (re)
   [255]
 Can the user leave the current state?
   $ hg up -C .


More information about the Mercurial-devel mailing list