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()
 


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()
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to