Patchwork [2,of,3] run-tests: fixed warn detection on failures with too many output

login
register
mail settings
Submitter Simon Heimberg
Date Feb. 16, 2014, 11:15 p.m.
Message ID <4035e88253d1ed7a2989.1392592502@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/3677/
State Accepted
Commit 72d843e8cb6d2ee6280a7265245a610cd7d5b3cf
Headers show

Comments

Simon Heimberg - Feb. 16, 2014, 11:15 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1392590484 -3600
#      Sun Feb 16 23:41:24 2014 +0100
# Node ID 4035e88253d1ed7a2989269b5773adfb9908be9a
# Parent  4b95042adedc640cd01e160dc98f34a8b5aa1c47
run-tests: fixed warn detection on failures with too many output

The state "warned" was reported too often. The problem fixed here is that
warnonly was only reset when a line did not match. When there was a line too
much, warnonly remained set.
Fix this by setting more states to warnonly.

More negative testing (testing on result "Failed") has been done this time.

Patch

diff -r 4b95042adedc -r 4035e88253d1 tests/run-tests.py
--- a/tests/run-tests.py	Sun Feb 16 23:36:02 2014 +0100
+++ b/tests/run-tests.py	Sun Feb 16 23:41:24 2014 +0100
@@ -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:
@@ -811,7 +813,9 @@ 
                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
                 postout.append("  " + lout) # let diff deal with it
                 if r != '': # if line failed
-                    warnonly = False
+                    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)