diff options
author | Pavel Labath <labath@google.com> | 2016-01-21 17:54:14 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2016-01-21 17:54:14 +0000 |
commit | e3e6be2aabbb50b6093e3ce05b9cdea56a088084 (patch) | |
tree | af06955503b181e2e553929c739f51977c40ece1 /lldb/packages/Python/lldbsuite/test | |
parent | c8adcb4af6131ecc427f128a208272c1eff2fc2b (diff) | |
download | bcm5719-llvm-e3e6be2aabbb50b6093e3ce05b9cdea56a088084.tar.gz bcm5719-llvm-e3e6be2aabbb50b6093e3ce05b9cdea56a088084.zip |
Enable test log collection from remote debug servers
Summary:
We already have the ability to collect the server logs when doing local debugging. This enables
the collection of remote logs as well. This relies on specifying a relative path "server.log" for
LLDB_DEBUGSERVER_LOG_FILE when starting remote platform. Since we always set the platform working
directory to a fresh folder to avoid conflicts, the actual file path will always be different and
we can pick the logs up from there.
Reviewers: tfiala
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D16322
llvm-svn: 258414
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbtest.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 63be1809c14..50b763d5c06 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1345,7 +1345,7 @@ class Base(unittest2.TestCase): 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 @@ -1354,12 +1354,15 @@ class Base(unittest2.TestCase): 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 @@ class Base(unittest2.TestCase): 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. |