[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@gmail.com>
This commit is contained in:
Med Ismail Bennani 2022-05-18 21:12:15 -07:00
parent fbf0c42294
commit 1351a9b19e
2 changed files with 13 additions and 8 deletions

View file

@ -36,8 +36,9 @@ class PExpectTest(TestBase):
if not use_colors: if not use_colors:
args += '--no-use-colors' args += '--no-use-colors'
for cmd in self.setUpCommands(): for cmd in self.setUpCommands():
if use_colors and "use-color false" not in cmd: if "use-color false" in cmd and use_colors:
args += ['-O', cmd] continue
args += ['-O', cmd]
if executable is not None: if executable is not None:
args += ['--file', executable] args += ['--file', executable]
if extra_args is not None: if extra_args is not None:
@ -58,9 +59,10 @@ class PExpectTest(TestBase):
post_spawn() post_spawn()
self.expect_prompt() self.expect_prompt()
for cmd in self.setUpCommands(): for cmd in self.setUpCommands():
if use_colors and "use-color false" not in cmd: if "use-color false" in cmd and use_colors:
self.child.expect_exact(cmd) continue
self.expect_prompt() self.child.expect_exact(cmd)
self.expect_prompt()
if executable is not None: if executable is not None:
self.child.expect_exact("target create") self.child.expect_exact("target create")
self.child.expect_exact("Current executable set to") self.child.expect_exact("Current executable set to")

View file

@ -26,7 +26,8 @@ class TestCase(PExpectTest):
@skipIfAsan @skipIfAsan
@skipIfEditlineSupportMissing @skipIfEditlineSupportMissing
def test_autosuggestion_add_spaces(self): 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. # Check if spaces are added to hide the previous gray characters.
@ -40,7 +41,8 @@ class TestCase(PExpectTest):
@skipIfAsan @skipIfAsan
@skipIfEditlineSupportMissing @skipIfEditlineSupportMissing
def test_autosuggestion(self): 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. # Common input codes.
ctrl_f = "\x06" ctrl_f = "\x06"
@ -107,7 +109,8 @@ class TestCase(PExpectTest):
@skipIfAsan @skipIfAsan
@skipIfEditlineSupportMissing @skipIfEditlineSupportMissing
def test_autosuggestion_custom_ansi_prefix_suffix(self): 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 use-color true",
"-o", "settings set show-autosuggestion-ansi-prefix ${ansi.fg.red}", "-o", "settings set show-autosuggestion-ansi-prefix ${ansi.fg.red}",
"-o", "setting set show-autosuggestion-ansi-suffix ${ansi.fg.cyan}"]) "-o", "setting set show-autosuggestion-ansi-suffix ${ansi.fg.cyan}"])