[Lldb-commits] [lldb] [lldb] Use validation combination of options in TestAbbreviations (PR #125270)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 31 11:21:07 PST 2025


https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/125270

>From a33e43e56e8a58c1d53c566c0b9da7791254d68e Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 31 Jan 2025 11:10:40 -0800
Subject: [PATCH 1/2] [lldb] Use validation combination of options in
 TestAbbreviations

Name and line number are part of different option groups and are not
compatible.

  (lldb) breakpoint set -n foo -l 10
  error: invalid combination of options for the given command

The help output for `breakpoint set` confirms this. This patch updates
the test to use two compatible options. With the improved error
reporting from #125125 this becomes an issue.
---
 .../API/functionalities/abbreviation/TestAbbreviations.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
index a8cbffbb7ba4a5..bef159501c6cd1 100644
--- a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
+++ b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
@@ -45,10 +45,10 @@ def test_command_abbreviations_and_aliases(self):
 
         # Make sure an unabbreviated command is not mangled.
         command_interpreter.ResolveCommand(
-            "breakpoint set --name main --line 123", result
+            "breakpoint set --name main --ignore-count 123", result
         )
         self.assertTrue(result.Succeeded())
-        self.assertEqual("breakpoint set --name main --line 123", result.GetOutput())
+        self.assertEqual("breakpoint set --name main --ignore-count 123", result.GetOutput())
 
         # Create some aliases.
         self.runCmd("com a alias com al")
@@ -72,10 +72,10 @@ def test_command_abbreviations_and_aliases(self):
             "process launch -s -o /dev/tty0 -e /dev/tty0", result.GetOutput()
         )
 
-        self.runCmd("alias xyzzy breakpoint set -n %1 -l %2")
+        self.runCmd("alias xyzzy breakpoint set -n %1 -i %2")
         command_interpreter.ResolveCommand("xyzzy main 123", result)
         self.assertTrue(result.Succeeded())
-        self.assertEqual("breakpoint set -n main -l 123", result.GetOutput().strip())
+        self.assertEqual("breakpoint set -n main -i 123", result.GetOutput().strip())
 
         # And again, without enough parameters.
         command_interpreter.ResolveCommand("xyzzy main", result)

>From 09cc81731b94aadd7941dcf9e0deae1f8c60272e Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 31 Jan 2025 11:20:12 -0800
Subject: [PATCH 2/2] Format TestAbbreviations.py

---
 .../API/functionalities/abbreviation/TestAbbreviations.py     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
index bef159501c6cd1..b4e770af0e392c 100644
--- a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
+++ b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
@@ -48,7 +48,9 @@ def test_command_abbreviations_and_aliases(self):
             "breakpoint set --name main --ignore-count 123", result
         )
         self.assertTrue(result.Succeeded())
-        self.assertEqual("breakpoint set --name main --ignore-count 123", result.GetOutput())
+        self.assertEqual(
+            "breakpoint set --name main --ignore-count 123", result.GetOutput()
+        )
 
         # Create some aliases.
         self.runCmd("com a alias com al")



More information about the lldb-commits mailing list