llvm.org GIT mirror llvm / 34f68fc
Print a message when a test failure is due to stderr output alone, rather than just an exit code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110208 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
1 changed file(s) with 17 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
469469 isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
470470 return script,isXFail,tmpBase,execdir
471471
472 def formatTestOutput(status, out, err, exitCode, script):
472 def formatTestOutput(status, out, err, exitCode, failDueToStderr, script):
473473 output = StringIO.StringIO()
474474 print >>output, "Script:"
475475 print >>output, "--"
476476 print >>output, '\n'.join(script)
477477 print >>output, "--"
478 print >>output, "Exit Code: %r" % exitCode
478 print >>output, "Exit Code: %r" % exitCode,
479 if failDueToStderr:
480 print >>output, "(but there was output on stderr)"
481 else:
482 print >>output
479483 if out:
480484 print >>output, "Command Output (stdout):"
481485 print >>output, "--"
510514 if len(res) == 2:
511515 return res
512516
513 # Test for failure. In addition to the exit code, Tcl commands fail
514 # if there is any standard error output.
517 # Test for failure. In addition to the exit code, Tcl commands are
518 # considered to fail if there is any standard error output.
515519 out,err,exitCode = res
516520 if isXFail:
517521 ok = exitCode != 0 or err
523527 if ok:
524528 return (status,'')
525529
526 return formatTestOutput(status, out, err, exitCode, script)
530 # Set a flag for formatTestOutput so it can explain why the test was
531 # considered to have failed, despite having an exit code of 0.
532 failDueToStderr = exitCode == 0 and err
533
534 return formatTestOutput(status, out, err, exitCode, failDueToStderr, script)
527535
528536 def executeShTest(test, litConfig, useExternalSh):
529537 if test.config.unsupported:
559567 if ok:
560568 return (status,'')
561569
562 return formatTestOutput(status, out, err, exitCode, script)
570 # Sh tests are not considered to fail just from stderr output.
571 failDueToStderr = False
572
573 return formatTestOutput(status, out, err, exitCode, failDueToStderr, script)