[Lldb-commits] [lldb] 1351a9b - [lldb/test] Fix failures caused by a previous PExpect.launch change

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Wed May 18 21:12:56 PDT 2022


Author: Med Ismail Bennani
Date: 2022-05-18T21:12:44-07:00
New Revision: 1351a9b19ecf48ebb2caad8ae6d8776a6dc1786d

URL: https://github.com/llvm/llvm-project/commit/1351a9b19ecf48ebb2caad8ae6d8776a6dc1786d
DIFF: https://github.com/llvm/llvm-project/commit/1351a9b19ecf48ebb2caad8ae6d8776a6dc1786d.diff

LOG: [lldb/test] Fix failures caused by a previous PExpect.launch change

This should fix the issues introduced by d71d1a9, which skipped all the
test setup commands.

This also fixes the test failures happening in TestAutosuggestion.py.

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbpexpect.py
    lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
index fe44c86d14f2f..1083705a20119 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -36,8 +36,9 @@ def launch(self, executable=None, extra_args=None, timeout=60,
         if not use_colors:
             args += '--no-use-colors'
         for cmd in self.setUpCommands():
-            if use_colors and "use-color false" not in cmd:
-                args += ['-O', cmd]
+            if "use-color false" in cmd and use_colors:
+                continue
+            args += ['-O', cmd]
         if executable is not None:
             args += ['--file', executable]
         if extra_args is not None:
@@ -58,9 +59,10 @@ def launch(self, executable=None, extra_args=None, timeout=60,
             post_spawn()
         self.expect_prompt()
         for cmd in self.setUpCommands():
-            if use_colors and "use-color false" not in cmd:
-                self.child.expect_exact(cmd)
-                self.expect_prompt()
+            if "use-color false" in cmd and use_colors:
+                continue
+            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")

diff  --git a/lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py b/lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py
index 80e45222a8157..7d29d95291abd 100644
--- a/lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py
+++ b/lldb/test/API/iohandler/autosuggestion/TestAutosuggestion.py
@@ -26,7 +26,8 @@ class TestCase(PExpectTest):
     @skipIfAsan
     @skipIfEditlineSupportMissing
     def test_autosuggestion_add_spaces(self):
-        self.launch(extra_args=["-o", "settings set show-autosuggestion true", "-o", "settings set use-color true"])
+        self.launch(use_colors=True,
+                    extra_args=["-o", "settings set show-autosuggestion true", "-o", "settings set use-color true"])
 
 
         # Check if spaces are added to hide the previous gray characters.
@@ -40,7 +41,8 @@ def test_autosuggestion_add_spaces(self):
     @skipIfAsan
     @skipIfEditlineSupportMissing
     def test_autosuggestion(self):
-        self.launch(extra_args=["-o", "settings set show-autosuggestion true", "-o", "settings set use-color true"])
+        self.launch(use_colors=True,
+                    extra_args=["-o", "settings set show-autosuggestion true", "-o", "settings set use-color true"])
 
         # Common input codes.
         ctrl_f = "\x06"
@@ -107,7 +109,8 @@ def test_autosuggestion(self):
     @skipIfAsan
     @skipIfEditlineSupportMissing
     def test_autosuggestion_custom_ansi_prefix_suffix(self):
-        self.launch(extra_args=["-o", "settings set show-autosuggestion true",
+        self.launch(use_colors=True,
+                    extra_args=["-o", "settings set show-autosuggestion true",
                                 "-o", "settings set use-color true",
                                 "-o", "settings set show-autosuggestion-ansi-prefix ${ansi.fg.red}",
                                 "-o", "setting set show-autosuggestion-ansi-suffix ${ansi.fg.cyan}"])


        


More information about the lldb-commits mailing list