[Lldb-commits] [lldb] r261974 - Make TestPlatformProcessConnect to support abstract/domain sockets.

Oleksiy Vyalov via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 25 20:01:58 PST 2016


Author: ovyalov
Date: Thu Feb 25 22:01:58 2016
New Revision: 261974

URL: http://llvm.org/viewvc/llvm-project?rev=261974&view=rev
Log:
Make TestPlatformProcessConnect to support abstract/domain sockets.


Modified:
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py?rev=261974&r1=261973&r2=261974&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py Thu Feb 25 22:01:58 2016
@@ -1,5 +1,7 @@
 from __future__ import print_function
 
+import time
+
 import gdbremote_testcase
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -22,11 +24,21 @@ class TestPlatformProcessConnect(gdbremo
         if err.Fail():
             raise RuntimeError("Unable copy '%s' to '%s'.\n>>> %s" % (f, wd, err.GetCString()))
 
+        m = re.search("^(.*)://([^:/]*)", configuration.lldb_platform_url)
+        protocol = m.group(1)
+        hostname = m.group(2)
+        unix_protocol = protocol.startswith("unix-")
+        if unix_protocol:
+            p = re.search("^(.*)-connect", protocol)
+            listen_url = "%s://%s" % (p.group(1), os.path.join(working_dir, "platform-%d.sock" % int(time.time())))
+        else:
+            listen_url = "*:0"
+
         port_file = "%s/port" % working_dir
-        commandline_args = ["platform", "--listen", "*:0", "--socket-file", port_file, "--", "%s/a.out" % working_dir, "foo"]
+        commandline_args = ["platform", "--listen", listen_url, "--socket-file", port_file, "--", "%s/a.out" % working_dir, "foo"]
         self.spawnSubprocess(self.debug_monitor_exe, commandline_args, install_remote=False)
         self.addTearDownHook(self.cleanupSubprocesses)
-        new_port = self.run_shell_cmd("while [ ! -f %s ]; do sleep 0.25; done && cat %s" % (port_file, port_file))
+        socket_id = self.run_shell_cmd("while [ ! -f %s ]; do sleep 0.25; done && cat %s" % (port_file, port_file))
 
         new_debugger = lldb.SBDebugger.Create()
         new_debugger.SetAsync(False)
@@ -38,8 +50,12 @@ class TestPlatformProcessConnect(gdbremo
         new_debugger.SetSelectedPlatform(new_platform)
         new_interpreter = new_debugger.GetCommandInterpreter()
 
-        m = re.search("(.*):[0-9]+", configuration.lldb_platform_url)
-        command = "platform connect %s:%s" % (m.group(1), new_port)
+        if unix_protocol:
+            connect_url = "%s://%s%s" % (protocol, hostname, socket_id)
+        else:
+            connect_url = "%s://%s:%s" % (protocol, hostname, socket_id)
+
+        command = "platform connect %s" % (connect_url)
         result = lldb.SBCommandReturnObject()
         new_interpreter.HandleCommand(command, result)
         self.assertTrue(result.Succeeded(), "platform process connect failed: %s" % result.GetOutput())




More information about the lldb-commits mailing list