[llvm-commits] [llvm] r138804 - in /llvm/trunk: test/lit.cfg utils/lit/lit/LitConfig.py utils/lit/lit/TestFormats.py utils/lit/lit/TestRunner.py utils/lit/lit/main.py

Andrew Trick atrick at apple.com
Tue Aug 30 10:42:33 PDT 2011


Author: atrick
Date: Tue Aug 30 12:42:33 2011
New Revision: 138804

URL: http://llvm.org/viewvc/llvm-project?rev=138804&view=rev
Log:
Lit option for ignoring stderr output.

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

Modified:
    llvm/trunk/test/lit.cfg
    llvm/trunk/utils/lit/lit/LitConfig.py
    llvm/trunk/utils/lit/lit/TestFormats.py
    llvm/trunk/utils/lit/lit/TestRunner.py
    llvm/trunk/utils/lit/lit/main.py

Modified: llvm/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=138804&r1=138803&r2=138804&view=diff
==============================================================================
--- llvm/trunk/test/lit.cfg (original)
+++ llvm/trunk/test/lit.cfg Tue Aug 30 12:42:33 2011
@@ -12,6 +12,9 @@
 # testFormat: The test format to use to interpret tests.
 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
 # set by on_clone().
 config.suffixes = []

Modified: llvm/trunk/utils/lit/lit/LitConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/LitConfig.py?rev=138804&r1=138803&r2=138804&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/LitConfig.py (original)
+++ llvm/trunk/utils/lit/lit/LitConfig.py Tue Aug 30 12:42:33 2011
@@ -20,7 +20,7 @@
     def __init__(self, progname, path, quiet,
                  useValgrind, valgrindLeakCheck, valgrindArgs,
                  useTclAsSh,
-                 noExecute, debug, isWindows,
+                 noExecute, ignoreStdErr, debug, isWindows,
                  params):
         # The name of the test runner.
         self.progname = progname
@@ -32,6 +32,7 @@
         self.valgrindUserArgs = list(valgrindArgs)
         self.useTclAsSh = bool(useTclAsSh)
         self.noExecute = noExecute
+        self.ignoreStdErr = ignoreStdErr
         self.debug = debug
         self.isWindows = bool(isWindows)
         self.params = dict(params)

Modified: llvm/trunk/utils/lit/lit/TestFormats.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestFormats.py?rev=138804&r1=138803&r2=138804&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestFormats.py (original)
+++ llvm/trunk/utils/lit/lit/TestFormats.py Tue Aug 30 12:42:33 2011
@@ -125,7 +125,11 @@
                                         self.execute_external)
 
 class TclTest(FileBasedTest):
+    def __init__(self, ignoreStdErr=False):
+        self.ignoreStdErr = ignoreStdErr
+        
     def execute(self, test, litConfig):
+        litConfig.ignoreStdErr = self.ignoreStdErr
         return TestRunner.executeTclTest(test, litConfig)
 
 ###

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=138804&r1=138803&r2=138804&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Tue Aug 30 12:42:33 2011
@@ -535,13 +535,13 @@
     # considered to fail if there is any standard error output.
     out,err,exitCode = res
     if isXFail:
-        ok = exitCode != 0 or err
+        ok = exitCode != 0 or err and not litConfig.ignoreStdErr
         if ok:
             status = Test.XFAIL
         else:
             status = Test.XPASS
     else:
-        ok = exitCode == 0 and not err
+        ok = exitCode == 0 and (not err or litConfig.ignoreStdErr)
         if ok:
             status = Test.PASS
         else:
@@ -552,7 +552,7 @@
 
     # 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
+    failDueToStderr = exitCode == 0 and err and not litConfig.ignoreStdErr
 
     return formatTestOutput(status, out, err, exitCode, failDueToStderr, script)
 

Modified: llvm/trunk/utils/lit/lit/main.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/main.py?rev=138804&r1=138803&r2=138804&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/main.py (original)
+++ llvm/trunk/utils/lit/lit/main.py Tue Aug 30 12:42:33 2011
@@ -328,6 +328,7 @@
                                     valgrindArgs = [],
                                     useTclAsSh = False,
                                     noExecute = False,
+                                    ignoreStdErr = False,
                                     debug = False,
                                     isWindows = (platform.system()=='Windows'),
                                     params = {})
@@ -485,6 +486,7 @@
                                     valgrindArgs = opts.valgrindArgs,
                                     useTclAsSh = opts.useTclAsSh,
                                     noExecute = opts.noExecute,
+                                    ignoreStdErr = False,
                                     debug = opts.debug,
                                     isWindows = (platform.system()=='Windows'),
                                     params = userParams)





More information about the llvm-commits mailing list