[PATCH 4 of 4 V2] run-tests: option for enabling automatic path matching on windows

Simon Heimberg simohe at besonet.ch
Wed Jul 17 20:34:58 CDT 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1374107277 -7200
# Node ID 62a4d588eeaf08166dc278d5052a8b8472028b49
# Parent  abe95fe9f9767fa4d08605c95e2d1045cf466bb0
run-tests: option for enabling automatic path matching on windows

run-tests.py will be even more strict than before. It will also fail on
path which do not need (glob). And it will write the expected output (with
glob appended or removed).
The option --winpathwarn enables automatic matching and only writes warning
messages for lines with missing glob.
With this change, users who can run the test-suite on windows can automatically
fix the output.

diff -r abe95fe9f976 -r 62a4d588eeaf tests/run-tests.py
--- a/tests/run-tests.py	Don Jul 18 01:06:35 2013 +0200
+++ b/tests/run-tests.py	Don Jul 18 02:27:57 2013 +0200
@@ -205,6 +205,8 @@
                       help='set the given config opt in the test hgrc')
     parser.add_option('--random', action="store_true",
                       help='run tests in random order')
+    parser.add_option('--winpathwarn', action='store_true',
+        help='warn only when local paths do not exactly match (windows)')
 
     for option, (envvar, default) in defaults.items():
         defaults[option] = type(default)(os.environ.get(envvar, default))
@@ -794,11 +796,19 @@
             if r:
                 postout.append("  " + el)
                 if r == 'slash':
-                    log('\nInfo, missing glob in test %s (after line %d): %s'
-                        % (test, pos, el))
+                    if options.winpathwarn:
+                        log('\nInfo, missing glob in test %s (after line %d): %s'
+                            % (test, pos, el))
+                    else:
+                        # append missing glob
+                        postout[-1] += ' (glob)'
                 elif r == 'glob':
-                    log('\ninfo, unnecessary glob in test %s (after line %d):'
-                        ' %s (glob)\n' % (test, pos, el[-1]))
+                    if options.winpathwarn:
+                        log('\ninfo, unnecessary glob in test %s (after line'
+                            ' %d): %s (glob)\n' % (test, pos, el[-1]))
+                    else:
+                        # drop extra glob
+                        postout[-1] = postout[-1].rsplit(' (', 1)[0]
             else:
                 if needescape(lout):
                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"


More information about the Mercurial-devel mailing list