Patchwork [1,of,3] run-tests: fixed warn detection on detecting warn only for lines

login
register
mail settings
Submitter Simon Heimberg
Date Feb. 16, 2014, 11:15 p.m.
Message ID <4b95042adedc640cd01e.1392592501@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/3676/
State Accepted
Commit 2e68882852eef1d14a03008c981d8dfce6d4166d
Headers show

Comments

Simon Heimberg - Feb. 16, 2014, 11:15 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1392590162 -3600
#      Sun Feb 16 23:36:02 2014 +0100
# Node ID 4b95042adedc640cd01e160dc98f34a8b5aa1c47
# Parent  0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd
run-tests: fixed warn detection on detecting warn only for lines

The state "warned" was reported too often. The main problem was that
"False == 0" is true in python. Therefore use an empty string instead of 0
for reporting warn only for a line.
The other problem is fixed in the next patch.

Patch

diff -r 0e2877f8605d -r 4b95042adedc tests/run-tests.py
--- a/tests/run-tests.py	Sat Feb 15 22:09:32 2014 -0600
+++ b/tests/run-tests.py	Sun Feb 16 23:36:02 2014 +0100
@@ -797,10 +797,10 @@ 
             if isinstance(r, str):
                 if r == '+glob':
                     lout = el[:-1] + ' (glob)\n'
-                    r = 0 # warn only
+                    r = '' # warn only this line
                 elif r == '-glob':
                     lout = ''.join(el.rsplit(' (glob)', 1))
-                    r = 0 # warn only
+                    r = '' # warn only this line
                 else:
                     log('\ninfo, unknown linematch result: %r\n' % r)
                     r = False
@@ -810,7 +810,7 @@ 
                 if needescape(lout):
                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
                 postout.append("  " + lout) # let diff deal with it
-                if r != 0: # != warn only
+                if r != '': # if line failed
                     warnonly = False
 
         if lcmd: