[Lldb-commits] [lldb] b62e558 - [lldb][test] Remove compiler version check and use regex (#123393)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 17 19:27:38 PST 2025
Author: Wanyi
Date: 2025-01-17T22:27:34-05:00
New Revision: b62e55803c52ca04093a0eea361407e849dc23e1
URL: https://github.com/llvm/llvm-project/commit/b62e55803c52ca04093a0eea361407e849dc23e1
DIFF: https://github.com/llvm/llvm-project/commit/b62e55803c52ca04093a0eea361407e849dc23e1.diff
LOG: [lldb][test] Remove compiler version check and use regex (#123393)
The test checks specific compiler version to determine the output.
However, the compiler version string is always set to 15.0.0 for our
local build. Remove this check and use regex match instead.
## Test Plan
```
./bin/llvm-lit -sva /home/wanyi/llvm-sand/external/llvm-project/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
...
Skipping the following test categories: ['dsym', 'gmodules', 'debugserver', 'objc']
--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/wanyi/llvm-sand/build/Release+Distribution/fbcode-x86_64/toolchain/bin/clang-x86_64) :: test_dsym (TestVectorOfVectorsFromStdModule.TestVectorOfVectors) (test case does not fall in any category of interest for this run)
PASS: LLDB (/home/wanyi/llvm-sand/build/Release+Distribution/fbcode-x86_64/toolchain/bin/clang-x86_64) :: test_dwarf (TestVectorOfVectorsFromStdModule.TestVectorOfVectors)
PASS: LLDB (/home/wanyi/llvm-sand/build/Release+Distribution/fbcode-x86_64/toolchain/bin/clang-x86_64) :: test_dwo (TestVectorOfVectorsFromStdModule.TestVectorOfVectors)
----------------------------------------------------------------------
Ran 3 tests in 4.636s
OK (skipped=1)
--
********************
Testing Time: 4.97s
Total Discovered Tests: 1
Passed: 1 (100.00%)
```
Added:
Modified:
lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
Removed:
################################################################################
diff --git a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
index 1c32222e64f14c..759077302bfca4 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py
@@ -23,13 +23,6 @@ def test(self):
self.runCmd("settings set target.import-std-module true")
- if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
- [">", "16.0"]
- ):
- vector_type = "std::vector<Foo>"
- else:
- vector_type = "std::vector<Foo, std::allocator<Foo> >"
-
size_type = "size_type"
value_type = "value_type"
iterator = "iterator"
@@ -41,13 +34,14 @@ def test(self):
ValueCheck(name="current"),
]
- self.expect_expr(
- "a",
- result_type=vector_type,
- result_children=[
- ValueCheck(children=[ValueCheck(value="3")]),
- ValueCheck(children=[ValueCheck(value="1")]),
- ValueCheck(children=[ValueCheck(value="2")]),
+ self.expect(
+ "expr a",
+ patterns=[
+ """\(std::vector<Foo(, std::allocator<Foo> )*>\) \$0 = size=3 \{
+ \[0\] = \(a = 3\)
+ \[1\] = \(a = 1\)
+ \[2\] = \(a = 2\)
+\}"""
],
)
diff --git a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
index a1f33271f39d2f..e18785ec1359cc 100644
--- a/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
+++ b/lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py
@@ -17,42 +17,26 @@ def test(self):
self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")
)
- if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
- [">", "16.0"]
- ):
- vector_type = "std::vector<int>"
- vector_of_vector_type = "std::vector<std::vector<int> >"
- else:
- vector_type = "std::vector<int>"
- vector_of_vector_type = (
- "std::vector<std::vector<int>, std::allocator<std::vector<int> > >"
- )
-
size_type = "size_type"
value_type = "value_type"
self.runCmd("settings set target.import-std-module true")
- self.expect_expr(
- "a",
- result_type=vector_of_vector_type,
- result_children=[
- ValueCheck(
- type=vector_type,
- children=[
- ValueCheck(value="1"),
- ValueCheck(value="2"),
- ValueCheck(value="3"),
- ],
- ),
- ValueCheck(
- type=vector_type,
- children=[
- ValueCheck(value="3"),
- ValueCheck(value="2"),
- ValueCheck(value="1"),
- ],
- ),
+ self.expect(
+ "expr a",
+ patterns=[
+ """\(std::vector<std::vector<int>(, std::allocator<std::vector<int> )* >\) \$0 = size=2 \{
+ \[0\] = size=3 \{
+ \[0\] = 1
+ \[1\] = 2
+ \[2\] = 3
+ \}
+ \[1\] = size=3 \{
+ \[0\] = 3
+ \[1\] = 2
+ \[2\] = 1
+ \}
+\}"""
],
)
self.expect_expr("a.size()", result_type=size_type, result_value="2")
More information about the lldb-commits
mailing list