diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-10-19 16:48:07 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-10-19 16:48:07 +0000 |
| commit | 2a808589033f4a569ea31a7aeeaa6d3cea672349 (patch) | |
| tree | 0c5353821dd1b2eeb94d6db28bb6eb0b7c9e5773 /lldb | |
| parent | 5450f218a6c602565c627fd3f94ead3279f7e7c5 (diff) | |
| download | bcm5719-llvm-2a808589033f4a569ea31a7aeeaa6d3cea672349.tar.gz bcm5719-llvm-2a808589033f4a569ea31a7aeeaa6d3cea672349.zip | |
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.
llvm-svn: 142532
Diffstat (limited to 'lldb')
| -rw-r--r-- | lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py | 2 | ||||
| -rw-r--r-- | lldb/test/lldbtest.py | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py b/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py index ec538a72fa0..b46216499eb 100644 --- a/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py +++ b/lldb/test/benchmarks/stepping/TestRunHooksThenSteppings.py @@ -38,7 +38,7 @@ class RunHooksThenSteppingsBench(BenchBase): #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() diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 9952b933798..bdbc10b7077 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -565,9 +565,13 @@ class Base(unittest2.TestCase): # 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 @@ class Base(unittest2.TestCase): """ 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. |

