[Lldb-commits] [lldb] r110487 - /lldb/trunk/test/dotest.py

Johnny Chen johnny.chen at apple.com
Fri Aug 6 17:16:07 PDT 2010


Author: johnny
Date: Fri Aug  6 19:16:07 2010
New Revision: 110487

URL: http://llvm.org/viewvc/llvm-project?rev=110487&view=rev
Log:
Putting out messages about the number of test cases to be run before running the
whole test suite.

Modified:
    lldb/trunk/test/dotest.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=110487&r1=110486&r2=110487&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Fri Aug  6 19:16:07 2010
@@ -19,6 +19,21 @@
 import time
 import unittest2
 
+class _WritelnDecorator(object):
+    """Used to decorate file-like objects with a handy 'writeln' method"""
+    def __init__(self,stream):
+        self.stream = stream
+
+    def __getattr__(self, attr):
+        if attr in ('stream', '__getstate__'):
+            raise AttributeError(attr)
+        return getattr(self.stream,attr)
+
+    def writeln(self, arg=None):
+        if arg:
+            self.write(arg)
+        self.write('\n') # text-mode streams translate to \r\n if needed
+
 #
 # Global variables:
 #
@@ -32,6 +47,12 @@
 # By default, search from the current working directory.
 testdirs = [ os.getcwd() ]
 
+# Separator string.
+separator = '-' * 70
+
+# Decorated sys.stdout.
+out = _WritelnDecorator(sys.stdout)
+
 
 def usage():
     print """
@@ -136,6 +157,10 @@
     os.path.walk(testdir, visit, 'Test')
 
 # Now that we have loaded all the test cases, run the whole test suite.
+out.writeln(separator)
+out.writeln("Collected %d test%s" % (suite.countTestCases(),
+                                     suite.countTestCases() != 1 and "s" or ""))
+out.writeln()
 
 # For the time being, let's bracket the test runner within the
 # lldb.SBDebugger.Initialize()/Terminate() pair.





More information about the lldb-commits mailing list