[Lldb-commits] [PATCH] D68727: Allow pexpect tests to work in remote testsuite runs

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 13:47:21 PDT 2019


friss created this revision.
friss added reviewers: teemperor, labath.
Herald added a project: LLDB.

This commit adds platform selection/connection commands to the base
PExpectTest class. I doesn't look like any of the current tests are
really interesting to test remotely, but it's easy enough to get
them to work.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68727

Files:
  lldb/packages/Python/lldbsuite/test/lldbpexpect.py


Index: lldb/packages/Python/lldbsuite/test/lldbpexpect.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -11,6 +11,7 @@
 import lldb
 from .lldbtest import *
 from . import lldbutil
+from lldbsuite.test import configuration
 
 if sys.platform.startswith('win32'):
     # llvm.org/pr22274: need a pexpect replacement for windows
@@ -33,8 +34,6 @@
             args = ['--no-lldbinit', '--no-use-colors']
             for cmd in self.setUpCommands():
                 args += ['-O', cmd]
-            if executable is not None:
-                args += ['--file', executable]
             if extra_args is not None:
                 args.extend(extra_args)
             self.child = pexpect.spawn(
@@ -44,8 +43,23 @@
             for cmd in self.setUpCommands():
                 self.child.expect_exact(cmd)
                 self.expect_prompt()
+
+            if configuration.lldb_platform_name:
+                self.child.sendline("platform select " + configuration.lldb_platform_name)
+                self.child.expect_exact("Platform: " + configuration.lldb_platform_name)
+                self.expect_prompt()
+                self.child.sendline("platform connect " + configuration.lldb_platform_url)
+                self.child.expect_exact("Connected: yes")
+                self.expect_prompt()
+
+                if configuration.lldb_platform_working_dir:
+                    self.child.sendline("platform mkdir " + configuration.lldb_platform_working_dir)
+                    self.expect_prompt()
+                    self.child.sendline("platform settings -w " + configuration.lldb_platform_working_dir)
+                    self.expect_prompt()
+
             if executable is not None:
-                self.child.expect_exact("target create")
+                self.child.sendline("target create " + executable)
                 self.child.expect_exact("Current executable set to")
                 self.expect_prompt()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68727.224150.patch
Type: text/x-patch
Size: 2075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191009/e1505f7f/attachment.bin>


More information about the lldb-commits mailing list