[PATCH 3 of 3] run-tests: accept '\' vs '/' path differences without '(glob)'

Matt Harbison mharbison72 at gmail.com
Sun Dec 10 15:47:45 EST 2017


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1512882971 18000
#      Sun Dec 10 00:16:11 2017 -0500
# Node ID ebc7a05d9389989fc2e81d30fa1c10dd01be9a76
# Parent  e1119050f15e2169ac766e6a69eeab70729e9e40
run-tests: accept '\' vs '/' path differences without '(glob)'

Having to constantly adjust these is a hassle.  It's easy for this to slip by
when not testing on Windows, and then when it happens on stable, the tests fail
for the next 3 months if we follow the rules for stable.

This works the same way the EOL differences are ignored, namely to adjust on the
fly and recheck on Windows.  I can't think of any situation where there would be
a '\' on Windows, a '/' elsewhere, and the '/' should be considered a failure on
Windows.

This fixes the obvious output problems where (glob) is missing.  Without this,
test-alias.t, test-remotenames.t and test-largefiles-misc.t are failing.  The
flip side (not handled by this) is the case where an unnecessary glob is
present.  There seems to be two separate behaviors.  cf300c1ad7bf is an example
of where the test has been autocorrecting (with output differences), and
d4ec69ff652a is an example where the test fails and reports 'no result code from
test'.  Hopefully those cases will become even more rare if people don't need to
guess at when a glob is needed for a Windows path.

It's probably unreasonable to submit a single patch that wipes out all of the
(glob) instances that were only used to hide path differences, given the churn
from other contributors.  Since their presence isn't harming the tests, these
can be removed through attrition.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1451,10 +1451,7 @@
 
                     r = self.linematch(el, lout)
                     if isinstance(r, str):
-                        if r == '+glob':
-                            lout = el[:-1] + ' (glob)\n'
-                            r = '' # Warn only this line.
-                        elif r == '-glob':
+                        if r == '-glob':
                             lout = ''.join(el.rsplit(' (glob)', 1))
                             r = '' # Warn only this line.
                         elif r == "retry":
@@ -1613,7 +1610,7 @@
             if os.altsep:
                 _l = l.replace(b'\\', b'/')
                 if el == _l or os.name == 'nt' and el[:-1] + b'\r\n' == _l:
-                    return b'+glob'
+                    return True
         return retry
 
     @staticmethod
diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py
--- a/tests/test-run-tests.py
+++ b/tests/test-run-tests.py
@@ -67,9 +67,9 @@
 
     missing glob
         >>> lm(b'/g/c/d/fg\n', b'\\g\\c\\d/fg\n')
-        'special: +glob'
+        True
         >>> lm(b'/g/c/d/fg\n', b'\\g\\c\\d\\fg\r\n')
-        'special: +glob'
+        True
 
     restore os.altsep
         >>> os.altsep = _osaltsep


More information about the Mercurial-devel mailing list