Lit option for ignoring stderr output.

This is useful for testing a build a temporarily hand instrumented
build.
Patch by arrowdodger!

llvm-svn: 138804
This commit is contained in:
Andrew Trick 2011-08-30 17:42:33 +00:00
parent 59b75285f6
commit d74c19449e
5 changed files with 14 additions and 4 deletions

View File

@ -12,6 +12,9 @@ config.name = 'LLVM'
# testFormat: The test format to use to interpret tests. # testFormat: The test format to use to interpret tests.
config.test_format = lit.formats.TclTest() config.test_format = lit.formats.TclTest()
# To ignore test output on stderr so it doesn't trigger failures uncomment this:
#config.test_format = lit.formats.TclTest(ignoreStdErr=True)
# suffixes: A list of file extensions to treat as test files, this is actually # suffixes: A list of file extensions to treat as test files, this is actually
# set by on_clone(). # set by on_clone().
config.suffixes = [] config.suffixes = []

View File

@ -20,7 +20,7 @@ class LitConfig:
def __init__(self, progname, path, quiet, def __init__(self, progname, path, quiet,
useValgrind, valgrindLeakCheck, valgrindArgs, useValgrind, valgrindLeakCheck, valgrindArgs,
useTclAsSh, useTclAsSh,
noExecute, debug, isWindows, noExecute, ignoreStdErr, debug, isWindows,
params): params):
# The name of the test runner. # The name of the test runner.
self.progname = progname self.progname = progname
@ -32,6 +32,7 @@ class LitConfig:
self.valgrindUserArgs = list(valgrindArgs) self.valgrindUserArgs = list(valgrindArgs)
self.useTclAsSh = bool(useTclAsSh) self.useTclAsSh = bool(useTclAsSh)
self.noExecute = noExecute self.noExecute = noExecute
self.ignoreStdErr = ignoreStdErr
self.debug = debug self.debug = debug
self.isWindows = bool(isWindows) self.isWindows = bool(isWindows)
self.params = dict(params) self.params = dict(params)

View File

@ -125,7 +125,11 @@ class ShTest(FileBasedTest):
self.execute_external) self.execute_external)
class TclTest(FileBasedTest): class TclTest(FileBasedTest):
def __init__(self, ignoreStdErr=False):
self.ignoreStdErr = ignoreStdErr
def execute(self, test, litConfig): def execute(self, test, litConfig):
litConfig.ignoreStdErr = self.ignoreStdErr
return TestRunner.executeTclTest(test, litConfig) return TestRunner.executeTclTest(test, litConfig)
### ###

View File

@ -535,13 +535,13 @@ def executeTclTest(test, litConfig):
# considered to fail if there is any standard error output. # considered to fail if there is any standard error output.
out,err,exitCode = res out,err,exitCode = res
if isXFail: if isXFail:
ok = exitCode != 0 or err ok = exitCode != 0 or err and not litConfig.ignoreStdErr
if ok: if ok:
status = Test.XFAIL status = Test.XFAIL
else: else:
status = Test.XPASS status = Test.XPASS
else: else:
ok = exitCode == 0 and not err ok = exitCode == 0 and (not err or litConfig.ignoreStdErr)
if ok: if ok:
status = Test.PASS status = Test.PASS
else: else:
@ -552,7 +552,7 @@ def executeTclTest(test, litConfig):
# Set a flag for formatTestOutput so it can explain why the test was # Set a flag for formatTestOutput so it can explain why the test was
# considered to have failed, despite having an exit code of 0. # considered to have failed, despite having an exit code of 0.
failDueToStderr = exitCode == 0 and err failDueToStderr = exitCode == 0 and err and not litConfig.ignoreStdErr
return formatTestOutput(status, out, err, exitCode, failDueToStderr, script) return formatTestOutput(status, out, err, exitCode, failDueToStderr, script)

View File

@ -328,6 +328,7 @@ def load_test_suite(inputs):
valgrindArgs = [], valgrindArgs = [],
useTclAsSh = False, useTclAsSh = False,
noExecute = False, noExecute = False,
ignoreStdErr = False,
debug = False, debug = False,
isWindows = (platform.system()=='Windows'), isWindows = (platform.system()=='Windows'),
params = {}) params = {})
@ -485,6 +486,7 @@ def main(builtinParameters = {}): # Bump the GIL check interval, its more imp
valgrindArgs = opts.valgrindArgs, valgrindArgs = opts.valgrindArgs,
useTclAsSh = opts.useTclAsSh, useTclAsSh = opts.useTclAsSh,
noExecute = opts.noExecute, noExecute = opts.noExecute,
ignoreStdErr = False,
debug = opts.debug, debug = opts.debug,
isWindows = (platform.system()=='Windows'), isWindows = (platform.system()=='Windows'),
params = userParams) params = userParams)