[Lldb-commits] [lldb] r121500 - in /lldb/trunk/test: dotest.py lldbtest.py

Johnny Chen johnny.chen at apple.com
Fri Dec 10 10:52:10 PST 2010


Author: johnny
Date: Fri Dec 10 12:52:10 2010
New Revision: 121500

URL: http://llvm.org/viewvc/llvm-project?rev=121500&view=rev
Log:
Add a '+a' command line option to the test driver to run only the Python API tests.
Add an attribute __python_api_test__ (set to True) to the @python_api_test decorated
test method to distinguish them from the lldb command line tests.

Modified:
    lldb/trunk/test/dotest.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=121500&r1=121499&r2=121500&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Fri Dec 10 12:52:10 2010
@@ -46,11 +46,11 @@
 suite = unittest2.TestSuite()
 
 # By default, both command line and Python API tests are performed.
-# See @python_api_test decorator in lldbtest.py.
+# Use @python_api_test decorator, defined in lldbtest.py, to mark a test as
+# a Python API test.
 dont_do_python_api_test = False
 
 # By default, both command line and Python API tests are performed.
-# This does not work yet as the @lldb_command_test decorator is needed.
 just_do_python_api_test = False
 
 # The blacklist is optional (-b blacklistFile) and allows a central place to skip
@@ -123,6 +123,7 @@
 -h   : print this help message and exit (also --help)
 -a   : don't do lldb Python API tests
        use @python_api_test to decorate a test case as lldb Python API test
++a   : just do lldb Python API tests
 -b   : read a blacklist file specified after this option
 -c   : read a config file specified after this option
        (see also lldb-trunk/example/test/usage-config)

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=121500&r1=121499&r2=121500&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Dec 10 12:52:10 2010
@@ -236,6 +236,8 @@
             self.skipTest("Skip Python API tests")
         return func(self, *args, **kwargs)
 
+    # Mark this function as such to separate them from lldb command line tests.
+    wrapper.__python_api_test__ = True
     return wrapper
 
 class recording(StringIO.StringIO):
@@ -477,6 +479,16 @@
             elif classAndMethodName in lldb.blacklist:
                 self.skipTest(lldb.blacklist.get(classAndMethodName))
 
+        # Python API only test is decorated with @python_api_test,
+        # which also sets the "__python_api_test__" attribute of the
+        # function object to True.
+        if lldb.just_do_python_api_test:
+            testMethod = getattr(self, self._testMethodName)
+            if getattr(testMethod, "__python_api_test__", False):
+                pass
+            else:
+                self.skipTest("Skip lldb command line test")
+
         if ("LLDB_WAIT_BETWEEN_TEST_CASES" in os.environ and
             os.environ["LLDB_WAIT_BETWEEN_TEST_CASES"] == 'YES'):
             waitTime = 1.0





More information about the lldb-commits mailing list