Patchwork [2,of,2] run-tests: teach _processoutput to handle multiple lines of churn

login
register
mail settings
Submitter timeless@mozdev.org
Date March 17, 2016, 9:17 p.m.
Message ID <de59c3332e009f964ab9.1458249455@waste.org>
Download mbox | patch
Permalink /patch/13926/
State Accepted
Headers show

Comments

timeless@mozdev.org - March 17, 2016, 9:17 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1458247926 0
#      Thu Mar 17 20:52:06 2016 +0000
# Node ID de59c3332e009f964ab9218d639e5635f8ea4305
# Parent  2d259ce76b6f0d4e11aac7f8e2a4db7785c3992d
run-tests: teach _processoutput to handle multiple lines of churn

Instead of treating expected output as happening in a precise order,
and assuming that if a line is missing it will never happen,
assume that expected output is a prioritized list of likely matching
lines.

This means that if:

 foo/bar (glob)
 baz/bad (glob)

changes to:

 baz/bad
 foo/bar

instead of generating:

 baz/bad
 foo/bar

For which we've lost both (glob) markers,
we will match both lines and generate:

 baz/bad (glob)
 foo/bar (glob)

This retains any special annotations we have for lines.
Pierre-Yves David - March 19, 2016, 6:40 a.m.
On 03/17/2016 02:17 PM, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1458247926 0
> #      Thu Mar 17 20:52:06 2016 +0000
> # Node ID de59c3332e009f964ab9218d639e5635f8ea4305
> # Parent  2d259ce76b6f0d4e11aac7f8e2a4db7785c3992d
> run-tests: teach _processoutput to handle multiple lines of churn

Pushed to the clowncopter. Consider adding a test in test-run-tests.py 
to avoid regression.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1108,10 +1108,14 @@ 
                     lout += b' (no-eol)\n'
 
                 # Find the expected output at the current position.
-                el = None
+                els = [None]
                 if expected.get(pos, None):
-                    el = expected[pos].pop(0)
-                if True:
+                    els = expected[pos]
+
+                i = 0
+                while i < len(els):
+                    el = els[i]
+
                     r = TTest.linematch(el, lout)
                     if isinstance(r, str):
                         if r == '+glob':
@@ -1122,11 +1126,19 @@ 
                             r = '' # Warn only this line.
                         elif r == "retry":
                             postout.append(b'  ' + el)
-                            continue
+                            els.pop(i)
+                            break
                         else:
                             log('\ninfo, unknown linematch result: %r\n' % r)
                             r = False
+                    if r:
+                        els.pop(i)
+                        break
+                    i += 1
+
                 if r:
+                    if r == "retry":
+                        continue
                     postout.append(b'  ' + el)
                 else:
                     if self.NEEDESCAPE(lout):