tests/run-tests.py
changeset 20509 8ac08939c3fc
parent 20508 91d4f82c2d3b
child 20510 edfbcc3163a8
equal deleted inserted replaced
20508:91d4f82c2d3b 20509:8ac08939c3fc
   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     pos = -1
   780     pos = -1
   780     postout = []
   781     postout = []
   781     for l in output:
   782     for l in output:
   782         lout, lcmd = l, None
   783         lout, lcmd = l, None
   783         if salt in l:
   784         if salt in l:
   794 
   795 
   795             r = linematch(el, lout)
   796             r = linematch(el, lout)
   796             if isinstance(r, str):
   797             if isinstance(r, str):
   797                 if r == '+glob':
   798                 if r == '+glob':
   798                     lout = el[:-1] + ' (glob)\n'
   799                     lout = el[:-1] + ' (glob)\n'
   799                     r = False
   800                     r = 0 # warn only
   800                 elif r == '-glob':
   801                 elif r == '-glob':
   801                     log('\ninfo, unnecessary glob in %s (after line %d):'
   802                     log('\ninfo, unnecessary glob in %s (after line %d):'
   802                         ' %s (glob)\n' % (test, pos, el[:-1]))
   803                         ' %s (glob)\n' % (test, pos, el[:-1]))
   803                     r = True # pass on unnecessary glob
   804                     r = True # pass on unnecessary glob
   804                 else:
   805                 else:
   808                 postout.append("  " + el)
   809                 postout.append("  " + el)
   809             else:
   810             else:
   810                 if needescape(lout):
   811                 if needescape(lout):
   811                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
   812                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
   812                 postout.append("  " + lout) # let diff deal with it
   813                 postout.append("  " + lout) # let diff deal with it
       
   814                 if r != 0: # != warn only
       
   815                     warnonly = False
   813 
   816 
   814         if lcmd:
   817         if lcmd:
   815             # add on last return code
   818             # add on last return code
   816             ret = int(lcmd.split()[1])
   819             ret = int(lcmd.split()[1])
   817             if ret != 0:
   820             if ret != 0:
   822             pos = int(lcmd.split()[0])
   825             pos = int(lcmd.split()[0])
   823 
   826 
   824     if pos in after:
   827     if pos in after:
   825         postout += after.pop(pos)
   828         postout += after.pop(pos)
   826 
   829 
       
   830     if warnonly and exitcode == 0:
       
   831         exitcode = False
   827     return exitcode, postout
   832     return exitcode, postout
   828 
   833 
   829 wifexited = getattr(os, "WIFEXITED", lambda x: False)
   834 wifexited = getattr(os, "WIFEXITED", lambda x: False)
   830 def run(cmd, wd, options, replacements, env):
   835 def run(cmd, wd, options, replacements, env):
   831     """Run command in a sub-process, capturing the output (stdout and stderr).
   836     """Run command in a sub-process, capturing the output (stdout and stderr).