Patchwork [v2] run-tests: automatically add (glob) to "saved backup bundle to" lines

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 3, 2015, 2:51 a.m.
Message ID <b607a539c97641508694.1420253515@localhost.localdomain>
Download mbox | patch
Permalink /patch/7308/
State Superseded
Headers show

Comments

Mads Kiilerich - Jan. 3, 2015, 2:51 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1417050270 -3600
#      Thu Nov 27 02:04:30 2014 +0100
# Node ID b607a539c976415086942b79aa764f664a1486cc
# Parent  9a02f75179390b109da0b9e2af6a7506c087f762
run-tests: automatically add (glob) to "saved backup bundle to" lines

Avoid spending too much time adding (glob) after running run-tests -i. This
doesn't handle all cases but it helps.

The run-tests tests add a bit of escaping of trailing (glob) in the output to
avoid interference from the outer test runner.
Pierre-Yves David - Jan. 4, 2015, 7:59 a.m.
On 01/02/2015 06:51 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1417050270 -3600
> #      Thu Nov 27 02:04:30 2014 +0100
> # Node ID b607a539c976415086942b79aa764f664a1486cc
> # Parent  9a02f75179390b109da0b9e2af6a7506c087f762
> run-tests: automatically add (glob) to "saved backup bundle to" lines

This one is pushed to the clowncopter. Thanks.
Augie Fackler - Jan. 6, 2015, 2:42 p.m.
On Sat, Jan 03, 2015 at 11:59:41PM -0800, Pierre-Yves David wrote:
>
>
> On 01/02/2015 06:51 PM, Mads Kiilerich wrote:
> ># HG changeset patch
> ># User Mads Kiilerich <madski@unity3d.com>
> ># Date 1417050270 -3600
> >#      Thu Nov 27 02:04:30 2014 +0100
> ># Node ID b607a539c976415086942b79aa764f664a1486cc
> ># Parent  9a02f75179390b109da0b9e2af6a7506c087f762
> >run-tests: automatically add (glob) to "saved backup bundle to" lines
>
> This one is pushed to the clowncopter. Thanks.

Since your push, he's mailed a v3. Not sure what's changed, but can
you (marmoute) take a look?

>
> --
> Pierre-Yves David
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Mads Kiilerich - Jan. 6, 2015, 4:16 p.m.
On 01/06/2015 03:42 PM, Augie Fackler wrote:
> On Sat, Jan 03, 2015 at 11:59:41PM -0800, Pierre-Yves David wrote:
>>
>> On 01/02/2015 06:51 PM, Mads Kiilerich wrote:
>>> # HG changeset patch
>>> # User Mads Kiilerich <madski@unity3d.com>
>>> # Date 1417050270 -3600
>>> #      Thu Nov 27 02:04:30 2014 +0100
>>> # Node ID b607a539c976415086942b79aa764f664a1486cc
>>> # Parent  9a02f75179390b109da0b9e2af6a7506c087f762
>>> run-tests: automatically add (glob) to "saved backup bundle to" lines
>> This one is pushed to the clowncopter. Thanks.
> Since your push, he's mailed a v3. Not sure what's changed, but can
> you (marmoute) take a look?

Matt mentioned on IRC that v2 failed on Python 2.<7 - I assume he thus 
already dropped it from the facebook queue.

This one works for me with the oldest python we support - 2.4.2 .

/Mads

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -627,6 +627,7 @@  class Test(unittest.TestCase):
             (r':%s\b' % self._startport, ':$HGPORT'),
             (r':%s\b' % (self._startport + 1), ':$HGPORT1'),
             (r':%s\b' % (self._startport + 2), ':$HGPORT2'),
+            (r'^(saved backup bundle to .*\.hg)( \(glob\))?$', r'\1 (glob)'),
             ]
 
         if os.name == 'nt':
@@ -1025,6 +1026,9 @@  class TTest(Test):
             if el.endswith(" (re)\n"):
                 return TTest.rematch(el[:-6], l)
             if el.endswith(" (glob)\n"):
+                # ignore '(glob)' added to l by 'replacements'
+                if l.endswith(" (glob)\n"):
+                    l = l[:-8] + "\n"
                 return TTest.globmatch(el[:-8], l)
             if os.altsep and l.replace('\\', '/') == el:
                 return '+glob'
@@ -1097,7 +1101,7 @@  def run(cmd, wd, replacements, env, debu
         killdaemons(env['DAEMON_PIDS'])
 
     for s, r in replacements:
-        output = re.sub(s, r, output)
+        output = re.sub(s, r, output, flags=re.M)
     return ret, output.splitlines(True)
 
 iolock = threading.RLock()
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -297,24 +297,43 @@  View the fix
 
 Accept the fix
 
-  $ echo 'y' | $TESTDIR/run-tests.py --with-hg=`which hg` -i
+  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
+  $ echo "  saved backup bundle to \$TESTTMP/foo.hg" >> test-failure.t
+  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
+  $ echo "  saved backup bundle to \$TESTTMP/foo.hg (glob)" >> test-failure.t
+  $ echo "  $ echo 'saved backup bundle to \$TESTTMP/foo.hg'" >> test-failure.t
+  $ echo "  saved backup bundle to \$TESTTMP/*.hg (glob)" >> test-failure.t
+  $ echo 'y' | $TESTDIR/run-tests.py --with-hg=`which hg` -i 2>&1 | \
+  >   sed -e 's,(glob)$,&<,g'
   
   --- $TESTTMP/test-failure.t
   +++ $TESTTMP/test-failure.t.err
-  @@ -1,4 +1,4 @@
+  @@ -1,9 +1,9 @@
      $ echo babar
   -  rataxes
   +  babar
    This is a noop statement so that
    this test is still more bytes than success.
+     $ echo 'saved backup bundle to $TESTTMP/foo.hg'
+  -  saved backup bundle to $TESTTMP/foo.hg
+  +  saved backup bundle to $TESTTMP/foo.hg (glob)<
+     $ echo 'saved backup bundle to $TESTTMP/foo.hg'
+     saved backup bundle to $TESTTMP/foo.hg (glob)<
+     $ echo 'saved backup bundle to $TESTTMP/foo.hg'
   Accept this change? [n] ..
   # Ran 2 tests, 0 skipped, 0 warned, 0 failed.
 
-  $ cat test-failure.t
+  $ sed -e 's,(glob)$,&<,g' test-failure.t
     $ echo babar
     babar
   This is a noop statement so that
   this test is still more bytes than success.
+    $ echo 'saved backup bundle to $TESTTMP/foo.hg'
+    saved backup bundle to $TESTTMP/foo.hg (glob)<
+    $ echo 'saved backup bundle to $TESTTMP/foo.hg'
+    saved backup bundle to $TESTTMP/foo.hg (glob)<
+    $ echo 'saved backup bundle to $TESTTMP/foo.hg'
+    saved backup bundle to $TESTTMP/*.hg (glob)<
 
 (reinstall)
   $ mv backup test-failure.t