[Lldb-commits] [lldb] r155268 - /lldb/branches/lldb-platform-work/test/lldbtest.py

Johnny Chen johnny.chen at apple.com
Fri Apr 20 18:15:08 PDT 2012


Author: johnny
Date: Fri Apr 20 20:15:08 2012
New Revision: 155268

URL: http://llvm.org/viewvc/llvm-project?rev=155268&view=rev
Log:
Redefine self.dbg.CreateTarget(filename) dynamically when running testsuite remotely in order to route
the call through the self.runCmd("file filename") and then to return the selected target to the api
client.

This change makes the test file TestAppleTypesIsProduced.py successfully executed remotely.
TestAppleTypesIsProduced.py

Modified:
    lldb/branches/lldb-platform-work/test/lldbtest.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=155268&r1=155267&r2=155268&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbtest.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbtest.py Fri Apr 20 20:15:08 2012
@@ -1047,6 +1047,21 @@
         if not self.dbg:
             raise Exception('Invalid debugger instance')
 
+        #
+        # Warning: MAJOR HACK AHEAD!
+        # If we are running testsuite remotely (by checking lldb.lldbtest_remote_sandbox),
+        # redefine the self.dbg.CreateTarget(filename) method to execute a "file filename"
+        # command, instead.  See also runCmd() where it decorates the "file filename" call
+        # with additional functionality when running testsuite remotely.
+        #
+        if lldb.lldbtest_remote_sandbox:
+            def DecoratedCreateTarget(arg):
+                self.runCmd("file %s" % arg)
+                return self.dbg.GetSelectedTarget()
+            self.dbg.CreateTarget = DecoratedCreateTarget
+            if self.TraceOn():
+                print "self.dbg.Create is redefined to:\n%s" % getsource_if_available(DecoratedCreateTarget)
+
         # We want our debugger to be synchronous.
         self.dbg.SetAsync(False)
 





More information about the lldb-commits mailing list