tests/run-tests.py
changeset 1349 42b428c5fcd8
parent 1348 2cb27f4b641c
child 1350 f541c0ba771c
--- a/tests/run-tests.py	Tue Feb 25 11:11:46 2014 +0000
+++ b/tests/run-tests.py	Sun Mar 02 13:53:07 2014 +0000
@@ -776,7 +776,9 @@
 
     # Merge the script output back into a unified test
 
-    warnonly = True
+    warnonly = 1 # 1: not yet, 2: yes, 3: for sure not
+    if exitcode != 0: # failure has been reported
+        warnonly = 3 # set to "for sure not"
     pos = -1
     postout = []
     for l in output:
@@ -797,10 +799,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,8 +812,10 @@
                 if needescape(lout):
                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
                 postout.append("  " + lout) # let diff deal with it
-                if r != 0: # != warn only
-                    warnonly = False
+                if r != '': # if line failed
+                    warnonly = 3 # set to "for sure not"
+                elif warnonly == 1: # is "not yet" (and line is warn only)
+                    warnonly = 2 # set to "yes" do warn
 
         if lcmd:
             # add on last return code
@@ -826,8 +830,8 @@
     if pos in after:
         postout += after.pop(pos)
 
-    if warnonly and exitcode == 0:
-        exitcode = False
+    if warnonly == 2:
+        exitcode = False # set exitcode to warned
     return exitcode, postout
 
 wifexited = getattr(os, "WIFEXITED", lambda x: False)