[llvm-commits] [llvm] r110208 - /llvm/trunk/utils/lit/lit/TestRunner.py
Dan Gohman
gohman at apple.com
Wed Aug 4 09:42:38 PDT 2010
Author: djg
Date: Wed Aug 4 11:42:38 2010
New Revision: 110208
URL: http://llvm.org/viewvc/llvm-project?rev=110208&view=rev
Log:
Print a message when a test failure is due to stderr output
alone, rather than just an exit code.
Modified:
llvm/trunk/utils/lit/lit/TestRunner.py
Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=110208&r1=110207&r2=110208&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Wed Aug 4 11:42:38 2010
@@ -470,13 +470,17 @@
isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
return script,isXFail,tmpBase,execdir
-def formatTestOutput(status, out, err, exitCode, script):
+def formatTestOutput(status, out, err, exitCode, failDueToStderr, script):
output = StringIO.StringIO()
print >>output, "Script:"
print >>output, "--"
print >>output, '\n'.join(script)
print >>output, "--"
- print >>output, "Exit Code: %r" % exitCode
+ print >>output, "Exit Code: %r" % exitCode,
+ if failDueToStderr:
+ print >>output, "(but there was output on stderr)"
+ else:
+ print >>output
if out:
print >>output, "Command Output (stdout):"
print >>output, "--"
@@ -511,8 +515,8 @@
if len(res) == 2:
return res
- # Test for failure. In addition to the exit code, Tcl commands fail
- # if there is any standard error output.
+ # Test for failure. In addition to the exit code, Tcl commands are
+ # considered to fail if there is any standard error output.
out,err,exitCode = res
if isXFail:
ok = exitCode != 0 or err
@@ -524,7 +528,11 @@
if ok:
return (status,'')
- return formatTestOutput(status, out, err, exitCode, script)
+ # Set a flag for formatTestOutput so it can explain why the test was
+ # considered to have failed, despite having an exit code of 0.
+ failDueToStderr = exitCode == 0 and err
+
+ return formatTestOutput(status, out, err, exitCode, failDueToStderr, script)
def executeShTest(test, litConfig, useExternalSh):
if test.config.unsupported:
@@ -560,4 +568,7 @@
if ok:
return (status,'')
- return formatTestOutput(status, out, err, exitCode, script)
+ # Sh tests are not considered to fail just from stderr output.
+ failDueToStderr = False
+
+ return formatTestOutput(status, out, err, exitCode, failDueToStderr, script)
More information about the llvm-commits
mailing list