[Lldb-commits] [lldb] r142532 - in /lldb/trunk/test: benchmarks/stepping/TestRunHooksThenSteppings.py lldbtest.py
Johnny Chen
johnny.chen at apple.com
Wed Oct 19 09:48:07 PDT 2011
Author: johnny
Date: Wed Oct 19 11:48:07 2011
New Revision: 142532
URL: http://llvm.org/viewvc/llvm-project?rev=142532&view=rev
Log:
Modify lldbtest.Base.runHooks() to now take the following keyword arguments:
child=None, child_prompt=None, use_cmd_api=False
By default, expect a pexpect spawned child and child prompt to be
supplied (use_cmd_api=False). If use_cmd_api is true, ignore the child
and child prompt and use self.runCmd() to run the hooks one by one.
Modify existing client to reflect the change.
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=142532&r1=142531&r2=142532&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py (original)
+++ lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py Wed Oct 19 11:48:07 2011
@@ -38,7 +38,7 @@
#lldb.runHooks = ['process attach -n Mail']
# Perform the run hooks to bring lldb debugger to the desired state.
- self.runHooks(child, prompt)
+ self.runHooks(child=child, child_prompt=prompt)
# Reset the stopwatch now.
self.stopwatch.reset()
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=142532&r1=142531&r2=142532&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Wed Oct 19 11:48:07 2011
@@ -565,9 +565,13 @@
# See HideStdout(self).
self.sys_stdout_hidden = False
- def runHooks(self, child, prompt):
+ def runHooks(self, child=None, child_prompt=None, use_cmd_api=False):
"""Perform the run hooks to bring lldb debugger to the desired state.
+ By default, expect a pexpect spawned child and child prompt to be
+ supplied (use_cmd_api=False). If use_cmd_api is true, ignore the child
+ and child prompt and use self.runCmd() to run the hooks one by one.
+
Note that child is a process spawned by pexpect.spawn(). If not, your
test case is mostly likely going to fail.
@@ -575,9 +579,15 @@
"""
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)
+ if use_cmd_api:
+ for hook in lldb.runhooks:
+ self.runCmd(hook)
+ else:
+ if not child or not child_prompt:
+ self.fail("Both child and child_prompt need to be defined.")
+ for hook in lldb.runHooks:
+ child.sendline(hook)
+ child.expect_exact(child_prompt)
def HideStdout(self):
"""Hide output to stdout from the user.
More information about the lldb-commits
mailing list