[Lldb-commits] [PATCH] Forward adb port for reverse connect test cases
Tamas Berghammer
tberghammer at google.com
Fri Mar 13 06:37:15 PDT 2015
Hi labath,
Forward adb port for reverse connect test cases
The test cases in TestStubReverseConnect are using a socket connection from python to lldb-server running on a remote target. To enable the socket connection an adb port forwarding have to be set up when the remote target is android.
http://reviews.llvm.org/D8319
Files:
test/tools/lldb-server/commandline/TestStubReverseConnect.py
test/tools/lldb-server/gdbremote_testcase.py
Index: test/tools/lldb-server/commandline/TestStubReverseConnect.py
===================================================================
--- test/tools/lldb-server/commandline/TestStubReverseConnect.py
+++ test/tools/lldb-server/commandline/TestStubReverseConnect.py
@@ -47,6 +47,10 @@
self.stub_hostname = "127.0.0.1"
self.port = self.listener_port
+ triple = self.dbg.GetSelectedPlatform().GetTriple()
+ if re.match(".*-.*-.*-android", triple):
+ self.forward_adb_port(self.port, self.port, "reverse")
+
# Start the stub.
server = self.launch_debug_monitor(logfile=sys.stdout)
self.assertIsNotNone(server)
Index: test/tools/lldb-server/gdbremote_testcase.py
===================================================================
--- test/tools/lldb-server/gdbremote_testcase.py
+++ test/tools/lldb-server/gdbremote_testcase.py
@@ -173,6 +173,13 @@
# when the process truly dies.
self.stub_sends_two_stop_notifications_on_kill = True
+ def forward_adb_port(self, source, target, direction):
+ def remove_port_forward():
+ subprocess.call(["adb", direction, "--remove", "tcp:%d" % source])
+
+ subprocess.call(["adb", direction, "tcp:%d" % source, "tcp:%d" % target])
+ self.addTearDownHook(remove_port_forward)
+
def create_socket(self):
sock = socket.socket()
logger = self.logger
@@ -194,11 +201,7 @@
triple = self.dbg.GetSelectedPlatform().GetTriple()
if re.match(".*-.*-.*-android", triple):
- subprocess.call(["adb", "forward", "tcp:%d" % self.port, "tcp:%d" % self.port])
- def remove_port_forward():
- subprocess.call(["adb", "forward", "--remove", "tcp:%d" % self.port])
-
- self.addTearDownHook(remove_port_forward)
+ self.forward_adb_port(self.port, self.port, "forward")
connect_info = (self.stub_hostname, self.port)
# print "connecting to stub on {}:{}".format(connect_info[0], connect_info[1])
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8319.21925.patch
Type: text/x-patch
Size: 2062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150313/6a6ec4b3/attachment.bin>
More information about the lldb-commits
mailing list