[Lldb-commits] [lldb] r155394 - in /lldb/branches/lldb-platform-work/test: lldbtest.py python_api/hello_world/TestHelloWorld.py

Johnny Chen johnny.chen at apple.com
Mon Apr 23 14:23:33 PDT 2012


Author: johnny
Date: Mon Apr 23 16:23:33 2012
New Revision: 155394

URL: http://llvm.org/viewvc/llvm-project?rev=155394&view=rev
Log:
Add a @not_remote_testsuite_ready decorator to mark test cases not ready for remote testsuite.
Also, target.LaunchSimple() does not seem to be working for the remote platform case.  Add a
workaround to route the call through self.runCmd("run") for the time being.

Modified:
    lldb/branches/lldb-platform-work/test/lldbtest.py
    lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py

Modified: lldb/branches/lldb-platform-work/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldbtest.py?rev=155394&r1=155393&r2=155394&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbtest.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbtest.py Mon Apr 23 16:23:33 2012
@@ -430,6 +430,23 @@
     wrapper.__dwarf_test__ = True
     return wrapper
 
+def not_remote_testsuite_ready(func):
+    """Decorate the item as a test which is not ready yet for remote testsuite."""
+    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+        raise Exception("@not_remote_testsuite_ready can only be used to decorate a test method")
+    @wraps(func)
+    def wrapper(self, *args, **kwargs):
+        try:
+            if lldb.lldbtest_remote_sandbox:
+                self.skipTest("not ready for remote testsuite")
+        except AttributeError:
+            pass
+        return func(self, *args, **kwargs)
+
+    # Mark this function as such to separate them from the regular tests.
+    wrapper.__not_ready_for_remote_testsuite_test__ = True
+    return wrapper
+
 def expectedFailureClang(func):
     """Decorate the item as a Clang only expectedFailure."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -1057,7 +1074,16 @@
         if lldb.lldbtest_remote_sandbox:
             def DecoratedCreateTarget(arg):
                 self.runCmd("file %s" % arg)
-                return self.dbg.GetSelectedTarget()
+                target = self.dbg.GetSelectedTarget()
+                #
+                # SBTarget.LaunchSimple() currently not working for remote platform?
+                # johnny @ 04/23/2012
+                #
+                def DecoratedLaunchSimple(argv, envp, wd):
+                    self.runCmd("run")
+                target.LaunchSimple = DecoratedLaunchSimple
+
+                return target
             self.dbg.CreateTarget = DecoratedCreateTarget
             if self.TraceOn():
                 print "self.dbg.Create is redefined to:\n%s" % getsource_if_available(DecoratedCreateTarget)

Modified: lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py?rev=155394&r1=155393&r2=155394&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py (original)
+++ lldb/branches/lldb-platform-work/test/python_api/hello_world/TestHelloWorld.py Mon Apr 23 16:23:33 2012
@@ -32,6 +32,7 @@
         self.setTearDownCleanup(dictionary=self.d)
         self.hello_world_python()
 
+    @not_remote_testsuite_ready
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dsym_test
@@ -44,6 +45,7 @@
         self.setTearDownCleanup(dictionary=self.d)
         self.hello_world_attach_with_id_api()
 
+    @not_remote_testsuite_ready
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_attach_to_process_with_id_api(self):
@@ -55,6 +57,7 @@
         self.setTearDownCleanup(dictionary=self.d)
         self.hello_world_attach_with_id_api()
 
+    @not_remote_testsuite_ready
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
     @dsym_test
@@ -67,6 +70,7 @@
         self.setTearDownCleanup(dictionary=self.d)
         self.hello_world_attach_with_name_api()
 
+    @not_remote_testsuite_ready
     @python_api_test
     @dwarf_test
     def test_with_dwarf_and_attach_to_process_with_name_api(self):





More information about the lldb-commits mailing list