Files
clang-p2996/lldb/test/functionalities/connect_remote/TestConnectRemote.py
Zachary Turner 0c426319f6 XFAIL pexpect tests on Windows.
At some point we will need to either provide a pexpect equivalent
on Windows, or provide some other method of doing out-of-process
tests.

Even with a pexpect replacement, it may be worth re-evaluating
some of these tests to see if they would be better served as
in-process tests.  The larger issue of coming up with a pexpect
replacement on Windows is tracked in http://llvm.org/pr22274.

llvm-svn: 226614
2015-01-20 22:36:03 +00:00

47 lines
1.4 KiB
Python

"""
Test lldb 'process connect' command.
"""
import os
import unittest2
import lldb
import re
from lldbtest import *
class ConnectRemoteTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
def test_connect_remote(self):
"""Test "process connect connect:://localhost:[port]"."""
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.
line = fakeserver.readline()
self.assertTrue(line.startswith("Listening on localhost:"))
port = int(re.match('Listening on localhost:([0-9]+)', line).group(1))
self.assertTrue(port > 0)
# Connect to the fake server....
self.runCmd("process connect -p gdb-remote connect://localhost:" + str(port))
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
atexit.register(lambda: lldb.SBDebugger.Terminate())
unittest2.main()