blob: d7674feeef04750bd3a15fde164c22b9a6aaea32 [file] [log] [blame]
Johnny Chen05178f62011-03-04 23:40:06 +00001"""
2Test lldb 'process connect' command.
3"""
4
Johnny Chenea76c4f2011-04-22 21:47:07 +00005import os
Johnny Chen05178f62011-03-04 23:40:06 +00006import unittest2
7import lldb
Johnny Chenea76c4f2011-04-22 21:47:07 +00008import pexpect
Johnny Chen05178f62011-03-04 23:40:06 +00009from lldbtest import *
10
11class ConnectRemoteTestCase(TestBase):
12
13 mydir = "connect_remote"
14
Johnny Chenaf4ab422011-03-08 23:35:45 +000015 @unittest2.expectedFailure
Johnny Chen05178f62011-03-04 23:40:06 +000016 def test_connect_remote(self):
17 """Test "process connect connect:://localhost:12345"."""
18
19 # First, we'll start a fake debugserver (a simple echo server).
Johnny Chenea76c4f2011-04-22 21:47:07 +000020 fakeserver = pexpect.spawn('./EchoServer.py')
Johnny Chen05178f62011-03-04 23:40:06 +000021
Johnny Chenea76c4f2011-04-22 21:47:07 +000022 # Turn on logging for what the child sends back.
23 if self.TraceOn():
Johnny Chenea0d1352011-04-22 21:56:22 +000024 fakeserver.logfile_read = sys.stdout
Johnny Chenea76c4f2011-04-22 21:47:07 +000025
Johnny Chen35c3ae92011-04-22 21:50:08 +000026 # Schedule the fake debugserver to be shutting down during teardown.
Johnny Chenea76c4f2011-04-22 21:47:07 +000027 def shutdown_fakeserver():
28 fakeserver.close()
29 self.addTearDownHook(shutdown_fakeserver)
30
31 # Wait until we receive the server ready message before continuing.
Johnny Chen09342682011-05-03 22:14:19 +000032 fakeserver.expect_exact('Listening on localhost:12345')
Johnny Chenea76c4f2011-04-22 21:47:07 +000033
34 # Connect to the fake server....
Johnny Chen05178f62011-03-04 23:40:06 +000035 self.runCmd("process connect connect://localhost:12345")
36
37
38if __name__ == '__main__':
39 import atexit
40 lldb.SBDebugger.Initialize()
41 atexit.register(lambda: lldb.SBDebugger.Terminate())
42 unittest2.main()