[Lldb-commits] [PATCH] D17798: Fetch remote log files from LLGS tests

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 2 17:05:32 PST 2016


LGTM!

-Todd

> On Mar 2, 2016, at 2:49 AM, Pavel Labath <labath at google.com> wrote:
> 
> labath created this revision.
> labath added a reviewer: tfiala.
> labath added a subscriber: lldb-commits.
> 
> this enables download of remote log files for llgs and debugserver tests (previously we were just
> passing the host file name which obviously did not work). Note this also changes the debugserver
> logging to work only when logging has been requested on the command line, whereas previously it
> would log unconditionally. I can change it back if anyone is relying on this, but I thought I'd
> make this consistent.
> 
> http://reviews.llvm.org/D17798
> 
> Files:
>  packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
> 
> Index: packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
> ===================================================================
> --- packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
> +++ packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
> @@ -47,6 +47,7 @@
> 
>     _verbose_log_handler = None
>     _log_formatter = logging.Formatter(fmt='%(asctime)-15s %(levelname)-8s %(message)s')
> +    _remote_server_log_file = None
> 
>     def setUpBaseLogging(self):
>         self.logger = logging.getLogger(__name__)
> @@ -104,10 +105,35 @@
>             self.stub_hostname = "localhost"
> 
>     def tearDown(self):
> +        if self._remote_server_log_file is not None:
> +            lldb.remote_platform.Get(lldb.SBFileSpec(self._remote_server_log_file),
> +                    lldb.SBFileSpec(self.getLocalServerLogFile()))
> +            lldb.remote_platform.Run(lldb.SBPlatformShellCommand("rm " + self._remote_server_log_file))
> +            self._remote_server_log_file = None
> +
>         self.logger.removeHandler(self._verbose_log_handler)
>         self._verbose_log_handler = None
>         TestBase.tearDown(self)
> 
> +    def getLocalServerLogFile(self):
> +        return self.log_basename + "-server.log"
> +
> +    def setUpServerLogging(self, is_llgs):
> +        if len(lldbtest_config.channels) == 0:
> +            return # No logging requested
> +
> +        if lldb.remote_platform:
> +            log_file = lldbutil.join_remote_paths(lldb.remote_platform.GetWorkingDirectory(), "server.log")
> +            self._remote_server_log_file = log_file
> +        else:
> +            log_file = self.getLocalServerLogFile()
> +
> +        if is_llgs:
> +            self.debug_monitor_extra_args.append("--log-file=" + log_file)
> +            self.debug_monitor_extra_args.append("--log-channels={}".format(":".join(lldbtest_config.channels)))
> +        else:
> +            self.debug_monitor_extra_args = ["--log-file=" + self.log_file, "--log-flags=0x800000"]
> +
>     def get_next_port(self):
>         return 12000 + random.randint(0,3999)
> 
> @@ -214,19 +240,16 @@
>                 self.skipTest("lldb-server exe not found")
> 
>         self.debug_monitor_extra_args = ["gdbserver"]
> -
> -        if len(lldbtest_config.channels) > 0:
> -            self.debug_monitor_extra_args.append("--log-file={}-server.log".format(self.log_basename))
> -            self.debug_monitor_extra_args.append("--log-channels={}".format(":".join(lldbtest_config.channels)))
> +        self.setUpServerLogging(is_llgs=True)
> 
>         if use_named_pipe:
>             (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = self.create_named_pipe()
> 
>     def init_debugserver_test(self, use_named_pipe=True):
>         self.debug_monitor_exe = get_debugserver_exe()
>         if not self.debug_monitor_exe:
>             self.skipTest("debugserver exe not found")
> -        self.debug_monitor_extra_args = ["--log-file={}-server.log".format(self.log_basename), "--log-flags=0x800000"]
> +        self.setUpServerLogging(is_llgs=False)
>         if use_named_pipe:
>             (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = self.create_named_pipe()
>         # The debugserver stub has a race on handling the 'k' command, so it sends an X09 right away, then sends the real X notification
> 
> 
> <D17798.49593.patch>


More information about the lldb-commits mailing list