This revision was automatically updated to reflect the committed changes.
Closed by commit rGd71d1a947bee: [lldb/Test] Add `use_colors` argument to the 
PExpect.launch wrapper (authored by mib).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125915/new/

https://reviews.llvm.org/D125915

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
@@ -24,16 +24,20 @@
         self.child.expect_exact(self.PROMPT)
 
     def launch(self, executable=None, extra_args=None, timeout=60,
-               dimensions=None, run_under=None, post_spawn=None):
+               dimensions=None, run_under=None, post_spawn=None,
+               use_colors=False):
         logfile = getattr(sys.stdout, 'buffer',
                             sys.stdout) if self.TraceOn() else None
 
         args = []
         if run_under is not None:
             args += run_under
-        args += [lldbtest_config.lldbExec, '--no-lldbinit', '--no-use-colors']
+        args += [lldbtest_config.lldbExec, '--no-lldbinit']
+        if not use_colors:
+            args += '--no-use-colors'
         for cmd in self.setUpCommands():
-            args += ['-O', cmd]
+            if use_colors and "use-color false" not in cmd:
+                args += ['-O', cmd]
         if executable is not None:
             args += ['--file', executable]
         if extra_args is not None:
@@ -54,8 +58,9 @@
             post_spawn()
         self.expect_prompt()
         for cmd in self.setUpCommands():
-            self.child.expect_exact(cmd)
-            self.expect_prompt()
+            if use_colors and "use-color false" not in cmd:
+                self.child.expect_exact(cmd)
+                self.expect_prompt()
         if executable is not None:
             self.child.expect_exact("target create")
             self.child.expect_exact("Current executable set to")


Index: lldb/packages/Python/lldbsuite/test/lldbpexpect.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -24,16 +24,20 @@
         self.child.expect_exact(self.PROMPT)
 
     def launch(self, executable=None, extra_args=None, timeout=60,
-               dimensions=None, run_under=None, post_spawn=None):
+               dimensions=None, run_under=None, post_spawn=None,
+               use_colors=False):
         logfile = getattr(sys.stdout, 'buffer',
                             sys.stdout) if self.TraceOn() else None
 
         args = []
         if run_under is not None:
             args += run_under
-        args += [lldbtest_config.lldbExec, '--no-lldbinit', '--no-use-colors']
+        args += [lldbtest_config.lldbExec, '--no-lldbinit']
+        if not use_colors:
+            args += '--no-use-colors'
         for cmd in self.setUpCommands():
-            args += ['-O', cmd]
+            if use_colors and "use-color false" not in cmd:
+                args += ['-O', cmd]
         if executable is not None:
             args += ['--file', executable]
         if extra_args is not None:
@@ -54,8 +58,9 @@
             post_spawn()
         self.expect_prompt()
         for cmd in self.setUpCommands():
-            self.child.expect_exact(cmd)
-            self.expect_prompt()
+            if use_colors and "use-color false" not in cmd:
+                self.child.expect_exact(cmd)
+                self.expect_prompt()
         if executable is not None:
             self.child.expect_exact("target create")
             self.child.expect_exact("Current executable set to")
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to