99% of this CL is simply moving calls to "import pexpect" to a more narrow scope - i.e. the function that actually runs a particular test. This way the test suite can run on Windows, which doesn't have pexpect, and the individual tests that use pexpect can be disabled on a platform-specific basis. Additionally, this CL fixes a few other cases of non-portability. Notably, using "ps" to get the command line, and os.uname() to determine the architecture don't work on Windows. Finally, this also adds a stubbed out builder_win32 module. The full test suite runs correctly on Windows after this CL, although there is still some work remaining on the C++ side to fix one-shot script commands from LLDB (e.g. script print "foo"), which currently deadlock. Reviewed by: Todd Fiala Differential Revision: http://reviews.llvm.org/D4573 llvm-svn: 213343
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""
|
|
Test lldb 'process connect' command.
|
|
"""
|
|
|
|
import os
|
|
import unittest2
|
|
import lldb
|
|
from lldbtest import *
|
|
|
|
class ConnectRemoteTestCase(TestBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
def test_connect_remote(self):
|
|
"""Test "process connect connect:://localhost:12345"."""
|
|
|
|
import pexpect
|
|
# First, we'll start a fake debugserver (a simple echo server).
|
|
fakeserver = pexpect.spawn('./EchoServer.py')
|
|
|
|
# Turn on logging for what the child sends back.
|
|
if self.TraceOn():
|
|
fakeserver.logfile_read = sys.stdout
|
|
|
|
# Schedule the fake debugserver to be shutting down during teardown.
|
|
def shutdown_fakeserver():
|
|
fakeserver.close()
|
|
self.addTearDownHook(shutdown_fakeserver)
|
|
|
|
# Wait until we receive the server ready message before continuing.
|
|
fakeserver.expect_exact('Listening on localhost:12345')
|
|
|
|
# Connect to the fake server....
|
|
self.runCmd("process connect -p gdb-remote connect://localhost:12345")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
import atexit
|
|
lldb.SBDebugger.Initialize()
|
|
atexit.register(lambda: lldb.SBDebugger.Terminate())
|
|
unittest2.main()
|