Patchwork [02,of,11,STABLE] tests: add "(glob)" to paths in test-run-tests.t for Windows

login
register
mail settings
Submitter Matt Mackall
Date Oct. 23, 2014, 6:43 p.m.
Message ID <1414089805.24136.7.camel@calx>
Download mbox | patch
Permalink /patch/6449/
State Not Applicable
Headers show

Comments

Matt Mackall - Oct. 23, 2014, 6:43 p.m.
On Fri, 2014-10-24 at 02:53 +0900, FUJIWARA Katsunori wrote:
> At Mon, 20 Oct 2014 15:54:25 +0200,
> Mads Kiilerich wrote:
> > 
> > On 10/20/2014 03:26 PM, FUJIWARA Katsunori wrote:
> > > # HG changeset patch
> > > # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> > > # Date 1413810488 -32400
> > > #      Mon Oct 20 22:08:08 2014 +0900
> > > # Branch stable
> > > # Node ID 8ffac97b85a5b2888f67e9b9a4d0cada7171fc76
> > > # Parent  ef382dbe8c20ee19e984ed26c8c46f93e50bf229
> > > tests: add "(glob)" to paths in test-run-tests.t for Windows
> > 
> > So much tedious work. How about something like
> > 
> > --- a/tests/run-tests.py
> > +++ b/tests/run-tests.py
> > @@ -600,7 +600,8 @@ class Test(unittest.TestCase):
> >               r.append(
> >                   (''.join(c.isalpha() and '[%s%s]' % (c.lower(), 
> > c.upper()) or
> >                       c in '/\\' and r'[/\\]' or c.isdigit() and c or 
> > '\\' + c
> > -                    for c in self._testtmp), '$TESTTMP'))
> > +                    for c in self._testtmp) + '([-._/a-zA-Z0-9]*)',
> > +                 lambda m: '$TESTTMP' + m.group(1).replace('\\', '/')))
> >           else:
> >               r.append((re.escape(self._testtmp), '$TESTTMP'))
> > 
> > ?
> 
> I also agree to the plan to avoid adding tedious "(glob)".
> 
> But at the same time, automatically replacing from '\\' to "/"
> prevents tests from examining whether "$TESTTMP" related path contains
> "\" correctly or not: for example, tests around 'ui.slash'.

Well, in this particular case, the issue is that _run-test's_ own diffs
change. And we can fix that very easily:
Katsunori FUJIWARA - Oct. 27, 2014, 11:15 a.m.
At Thu, 23 Oct 2014 13:43:25 -0500,
Matt Mackall wrote:
> 
> On Fri, 2014-10-24 at 02:53 +0900, FUJIWARA Katsunori wrote:
> > At Mon, 20 Oct 2014 15:54:25 +0200,
> > Mads Kiilerich wrote:
> > > 
> > > On 10/20/2014 03:26 PM, FUJIWARA Katsunori wrote:
> > > > # HG changeset patch
> > > > # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> > > > # Date 1413810488 -32400
> > > > #      Mon Oct 20 22:08:08 2014 +0900
> > > > # Branch stable
> > > > # Node ID 8ffac97b85a5b2888f67e9b9a4d0cada7171fc76
> > > > # Parent  ef382dbe8c20ee19e984ed26c8c46f93e50bf229
> > > > tests: add "(glob)" to paths in test-run-tests.t for Windows
> > > 
> > > So much tedious work. How about something like
> > > 
> > > --- a/tests/run-tests.py
> > > +++ b/tests/run-tests.py
> > > @@ -600,7 +600,8 @@ class Test(unittest.TestCase):
> > >               r.append(
> > >                   (''.join(c.isalpha() and '[%s%s]' % (c.lower(), 
> > > c.upper()) or
> > >                       c in '/\\' and r'[/\\]' or c.isdigit() and c or 
> > > '\\' + c
> > > -                    for c in self._testtmp), '$TESTTMP'))
> > > +                    for c in self._testtmp) + '([-._/a-zA-Z0-9]*)',
> > > +                 lambda m: '$TESTTMP' + m.group(1).replace('\\', '/')))
> > >           else:
> > >               r.append((re.escape(self._testtmp), '$TESTTMP'))
> > > 
> > > ?
> > 
> > I also agree to the plan to avoid adding tedious "(glob)".
> > 
> > But at the same time, automatically replacing from '\\' to "/"
> > prevents tests from examining whether "$TESTTMP" related path contains
> > "\" correctly or not: for example, tests around 'ui.slash'.
> 
> Well, in this particular case, the issue is that _run-test's_ own diffs
> change. And we can fix that very easily:

Oops, I overlooked that problematic lines were not output of ordinary
test target but one of difference between expected output lines and
actual ones.

These should be fixed not by "(glob)" but by internal replacing, as
you mentioned.


> diff -r c312ef382033 tests/run-tests.py
> --- a/tests/run-tests.py	Thu Oct 23 12:35:10 2014 -0200
> +++ b/tests/run-tests.py	Thu Oct 23 13:39:06 2014 -0500
> @@ -298,6 +298,7 @@
>      lines = []
>      for line in difflib.unified_diff(expected, output, ref, err):
>          if line.startswith('+++') or line.startswith('---'):
> +            line = line.replace('\\', '/')
>              if line.endswith(' \n'):
>                  line = line[:-2] + '\n'
>          lines.append(line)
> 
> -- 
> Mathematics is the supreme nostalgia of our time.
> 
> 
> 

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy@lares.dti.ne.jp

Patch

diff -r c312ef382033 tests/run-tests.py
--- a/tests/run-tests.py	Thu Oct 23 12:35:10 2014 -0200
+++ b/tests/run-tests.py	Thu Oct 23 13:39:06 2014 -0500
@@ -298,6 +298,7 @@ 
     lines = []
     for line in difflib.unified_diff(expected, output, ref, err):
         if line.startswith('+++') or line.startswith('---'):
+            line = line.replace('\\', '/')
             if line.endswith(' \n'):
                 line = line[:-2] + '\n'
         lines.append(line)