[Lldb-commits] [lldb] r132372 - /lldb/trunk/test/lldbtest.py

Johnny Chen johnny.chen at apple.com
Tue May 31 16:21:43 PDT 2011


Author: johnny
Date: Tue May 31 18:21:42 2011
New Revision: 132372

URL: http://llvm.org/viewvc/llvm-project?rev=132372&view=rev
Log:
Fix out-dated module docstring for lldbtest.py.  Also wrap some lldb attribute references
inside a try-except block in case the test is not invoked through the dotest.py test driver.

Modified:
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=132372&r1=132371&r2=132372&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue May 31 18:21:42 2011
@@ -13,7 +13,7 @@
 LLDB_TEST and PYTHONPATH environment variables, for example:
 
 $ export LLDB_TEST=$PWD
-$ export PYTHONPATH=/Volumes/data/lldb/svn/trunk/build/Debug/LLDB.framework/Resources/Python:$LLDB_TEST:$LLDB_TEST/plugins
+$ export PYTHONPATH=/Volumes/data/lldb/svn/trunk/build/Debug/LLDB.framework/Resources/Python:$LLDB_TEST:$LLDB_TEST/plugins:$LLDB_TEST/pexpect-2.4
 $ echo $LLDB_TEST
 /Volumes/data/lldb/svn/trunk/test
 $ echo $PYTHONPATH
@@ -234,8 +234,11 @@
         raise Exception("@python_api_test can only be used to decorate a test method")
     @wraps(func)
     def wrapper(self, *args, **kwargs):
-        if lldb.dont_do_python_api_test:
-            self.skipTest("Skip Python API tests")
+        try:
+            if lldb.dont_do_python_api_test:
+                self.skipTest("Skip Python API tests")
+        except AttributeError:
+            pass
         return func(self, *args, **kwargs)
 
     # Mark this function as such to separate them from lldb command line tests.
@@ -477,23 +480,29 @@
         if "LLDB_EXEC" in os.environ:
             self.lldbExec = os.environ["LLDB_EXEC"]
 
-        if lldb.blacklist:
-            className = self.__class__.__name__
-            classAndMethodName = "%s.%s" % (className, self._testMethodName)
-            if className in lldb.blacklist:
-                self.skipTest(lldb.blacklist.get(className))
-            elif classAndMethodName in lldb.blacklist:
-                self.skipTest(lldb.blacklist.get(classAndMethodName))
+        try:
+            if lldb.blacklist:
+                className = self.__class__.__name__
+                classAndMethodName = "%s.%s" % (className, self._testMethodName)
+                if className in lldb.blacklist:
+                    self.skipTest(lldb.blacklist.get(className))
+                elif classAndMethodName in lldb.blacklist:
+                    self.skipTest(lldb.blacklist.get(classAndMethodName))
+        except AttributeError:
+            pass
 
         # 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")
+        try:
+            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")
+        except AttributeError:
+            pass
 
         if ("LLDB_WAIT_BETWEEN_TEST_CASES" in os.environ and
             os.environ["LLDB_WAIT_BETWEEN_TEST_CASES"] == 'YES'):





More information about the lldb-commits mailing list