[Lldb-commits] [lldb] r142469 - in /lldb/trunk/test: benchmarks/stepping/TestRunHooksThenSteppings.py lldbtest.py

Johnny Chen johnny.chen at apple.com
Tue Oct 18 18:06:21 PDT 2011


Author: johnny
Date: Tue Oct 18 20:06:21 2011
New Revision: 142469

URL: http://llvm.org/viewvc/llvm-project?rev=142469&view=rev
Log:
Extract the run hooks functionality into the base class lldbtest.Base.

Modified:
    lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py?rev=142469&r1=142468&r2=142469&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py (original)
+++ lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py Tue Oct 18 20:06:21 2011
@@ -38,17 +38,13 @@
         #lldb.runHooks = ['process attach -n Mail']
 
         # Perform the run hooks to bring lldb debugger to the desired state.
-        if not lldb.runHooks:
-            self.skipTest("No runhooks specified for lldb, skip the test")
-        for hook in lldb.runHooks:
-            child.sendline(hook)
-            child.expect_exact(prompt)
+        self.runHooks(child, prompt)
 
         # Reset the stopwatch now.
         self.stopwatch.reset()
         for i in range(count):
             with self.stopwatch:
-                # Disassemble the function.
+                # Step through the function.
                 child.sendline('next') # Aka 'thread step-over'.
                 child.expect_exact(prompt)
 

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=142469&r1=142468&r2=142469&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue Oct 18 20:06:21 2011
@@ -565,6 +565,20 @@
         # See HideStdout(self).
         self.sys_stdout_hidden = False
 
+    def runHooks(self, child, prompt):
+        """Perform the run hooks to bring lldb debugger to the desired state.
+
+        Note that child is a process spawned by pexpect.spawn().  If not, your
+        test case is mostly likely going to fail.
+
+        See also dotest.py where lldb.runHooks are processed/populated.
+        """
+        if not lldb.runHooks:
+            self.skipTest("No runhooks specified for lldb, skip the test")
+        for hook in lldb.runHooks:
+            child.sendline(hook)
+            child.expect_exact(prompt)
+
     def HideStdout(self):
         """Hide output to stdout from the user.
 





More information about the lldb-commits mailing list