[Lldb-commits] [lldb] r130797 - in /lldb/trunk/test: command_regex/TestCommandRegex.py connect_remote/TestConnectRemote.py lldbtest.py
Johnny Chen
johnny.chen at apple.com
Tue May 3 15:14:20 PDT 2011
Author: johnny
Date: Tue May 3 17:14:19 2011
New Revision: 130797
URL: http://llvm.org/viewvc/llvm-project?rev=130797&view=rev
Log:
Use a more gentle way of shutting down the child process spawned during the test execution using pexpect.
Change some child.expect() to child.expect_exact() as they try to match the string, not a regular expression.
Modified:
lldb/trunk/test/command_regex/TestCommandRegex.py
lldb/trunk/test/connect_remote/TestConnectRemote.py
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/command_regex/TestCommandRegex.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/command_regex/TestCommandRegex.py?rev=130797&r1=130796&r2=130797&view=diff
==============================================================================
--- lldb/trunk/test/command_regex/TestCommandRegex.py (original)
+++ lldb/trunk/test/command_regex/TestCommandRegex.py Tue May 3 17:14:19 2011
@@ -14,7 +14,7 @@
def test_command_regex(self):
"""Test a simple scenario of 'command regexp' invocation and subsequent use."""
- prompt = "\(lldb\) "
+ prompt = "(lldb) "
regex_prompt = "Enter regular expressions in the form 's/<regex>/<subst>/' and terminate with an empty line:\r\n"
regex_prompt1 = "\r\n"
@@ -25,12 +25,12 @@
# So that the spawned lldb session gets shutdown durng teardown.
self.child = child
- # Substitute 'Help!' with 'help' using the 'commands regex' mechanism.
- child.expect(prompt)
+ # Substitute 'Help!' for 'help' using the 'commands regex' mechanism.
+ child.expect_exact(prompt)
child.sendline("command regex 'Help!'")
- child.expect(regex_prompt)
+ child.expect_exact(regex_prompt)
child.sendline('s/^$/help/')
- child.expect(regex_prompt1)
+ child.expect_exact(regex_prompt1)
child.sendline('')
# Help!
child.sendline('Help!')
Modified: lldb/trunk/test/connect_remote/TestConnectRemote.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/connect_remote/TestConnectRemote.py?rev=130797&r1=130796&r2=130797&view=diff
==============================================================================
--- lldb/trunk/test/connect_remote/TestConnectRemote.py (original)
+++ lldb/trunk/test/connect_remote/TestConnectRemote.py Tue May 3 17:14:19 2011
@@ -29,7 +29,7 @@
self.addTearDownHook(shutdown_fakeserver)
# Wait until we receive the server ready message before continuing.
- fakeserver.expect('Listening on localhost:12345')
+ fakeserver.expect_exact('Listening on localhost:12345')
# Connect to the fake server....
self.runCmd("process connect connect://localhost:12345")
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=130797&r1=130796&r2=130797&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue May 3 17:14:19 2011
@@ -678,12 +678,15 @@
# This is for the case of directly spawning 'lldb' and interacting with it
# using pexpect.
+ import pexpect
if self.child and self.child.isalive():
with recording(self, traceAlways) as sbuf:
print >> sbuf, "tearing down the child process...."
self.child.sendline('quit')
- time.sleep(2)
- self.child.close()
+ try:
+ self.child.expect(pexpect.EOF)
+ except:
+ pass
# Terminate the current process being debugged, if any.
if self.runStarted:
More information about the lldb-commits
mailing list