tests/run-tests.py
branchstable
changeset 1348 2cb27f4b641c
parent 1347 0ec1025011f4
child 1350 f541c0ba771c
equal deleted inserted replaced
1347:0ec1025011f4 1348:2cb27f4b641c
   774     if exitcode == SKIPPED_STATUS or output is None:
   774     if exitcode == SKIPPED_STATUS or output is None:
   775         return exitcode, output
   775         return exitcode, output
   776 
   776 
   777     # Merge the script output back into a unified test
   777     # Merge the script output back into a unified test
   778 
   778 
   779     warnonly = True
   779     warnonly = 1 # 1: not yet, 2: yes, 3: for sure not
       
   780     if exitcode != 0: # failure has been reported
       
   781         warnonly = 3 # set to "for sure not"
   780     pos = -1
   782     pos = -1
   781     postout = []
   783     postout = []
   782     for l in output:
   784     for l in output:
   783         lout, lcmd = l, None
   785         lout, lcmd = l, None
   784         if salt in l:
   786         if salt in l:
   809             else:
   811             else:
   810                 if needescape(lout):
   812                 if needescape(lout):
   811                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
   813                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
   812                 postout.append("  " + lout) # let diff deal with it
   814                 postout.append("  " + lout) # let diff deal with it
   813                 if r != '': # if line failed
   815                 if r != '': # if line failed
   814                     warnonly = False
   816                     warnonly = 3 # set to "for sure not"
       
   817                 elif warnonly == 1: # is "not yet" (and line is warn only)
       
   818                     warnonly = 2 # set to "yes" do warn
   815 
   819 
   816         if lcmd:
   820         if lcmd:
   817             # add on last return code
   821             # add on last return code
   818             ret = int(lcmd.split()[1])
   822             ret = int(lcmd.split()[1])
   819             if ret != 0:
   823             if ret != 0:
   824             pos = int(lcmd.split()[0])
   828             pos = int(lcmd.split()[0])
   825 
   829 
   826     if pos in after:
   830     if pos in after:
   827         postout += after.pop(pos)
   831         postout += after.pop(pos)
   828 
   832 
   829     if warnonly and exitcode == 0:
   833     if warnonly == 2:
   830         exitcode = False
   834         exitcode = False # set exitcode to warned
   831     return exitcode, postout
   835     return exitcode, postout
   832 
   836 
   833 wifexited = getattr(os, "WIFEXITED", lambda x: False)
   837 wifexited = getattr(os, "WIFEXITED", lambda x: False)
   834 def run(cmd, wd, options, replacements, env):
   838 def run(cmd, wd, options, replacements, env):
   835     """Run command in a sub-process, capturing the output (stdout and stderr).
   839     """Run command in a sub-process, capturing the output (stdout and stderr).