[Lldb-commits] [PATCH] D16322: Enable test log collection from remote debug servers

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 21 09:58:19 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL258414: Enable test log collection from remote debug servers (authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D16322?vs=45273&id=45553#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16322

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -1345,21 +1345,24 @@
             else:
                 categories = "default"
 
-            if channel == "gdb-remote":
+            if channel == "gdb-remote" and lldb.remote_platform is None:
                 # communicate gdb-remote categories to debugserver
                 os.environ["LLDB_DEBUGSERVER_LOG_FLAGS"] = categories
 
             self.ci.HandleCommand(log_enable + channel_with_categories, self.res)
             if not self.res.Succeeded():
                 raise Exception('log enable failed (check LLDB_LOG_OPTION env variable)')
 
         # Communicate log path name to debugserver & lldb-server
-        server_log_path = "{}-server.log".format(log_basename)
-        open(server_log_path, 'w').close()
-        os.environ["LLDB_DEBUGSERVER_LOG_FILE"] = server_log_path
+        # For remote debugging, these variables need to be set when starting the platform
+        # instance.
+        if lldb.remote_platform is None:
+            server_log_path = "{}-server.log".format(log_basename)
+            open(server_log_path, 'w').close()
+            os.environ["LLDB_DEBUGSERVER_LOG_FILE"] = server_log_path
 
-        # Communicate channels to lldb-server
-        os.environ["LLDB_SERVER_LOG_CHANNELS"] = ":".join(lldbtest_config.channels)
+            # Communicate channels to lldb-server
+            os.environ["LLDB_SERVER_LOG_CHANNELS"] = ":".join(lldbtest_config.channels)
 
         if len(lldbtest_config.channels) == 0:
             return
@@ -1373,6 +1376,15 @@
             if not self.res.Succeeded():
                 raise Exception('log disable failed (check LLDB_LOG_OPTION env variable)')
 
+        # Retrieve the server log (if any) from the remote system. It is assumed the server log
+        # is writing to the "server.log" file in the current test directory. This can be
+        # achieved by setting LLDB_DEBUGSERVER_LOG_FILE="server.log" when starting remote
+        # platform. If the remote logging is not enabled, then just let the Get() command silently
+        # fail.
+        if lldb.remote_platform:
+            lldb.remote_platform.Get(lldb.SBFileSpec("server.log"),
+                    lldb.SBFileSpec(self.getLogBasenameForCurrentTest()+"-server.log"))
+
     def setUp(self):
         """Fixture for unittest test case setup.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16322.45553.patch
Type: text/x-patch
Size: 2552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160121/7d502ed9/attachment-0001.bin>


More information about the lldb-commits mailing list