Skip to content

Commit b62e558

Browse files
authored
[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%) ```
1 parent a7bca18 commit b62e558

File tree

2 files changed

+23
-45
lines changed

2 files changed

+23
-45
lines changed

lldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ def test(self):
2323

2424
self.runCmd("settings set target.import-std-module true")
2525

26-
if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
27-
[">", "16.0"]
28-
):
29-
vector_type = "std::vector<Foo>"
30-
else:
31-
vector_type = "std::vector<Foo, std::allocator<Foo> >"
32-
3326
size_type = "size_type"
3427
value_type = "value_type"
3528
iterator = "iterator"
@@ -41,13 +34,14 @@ def test(self):
4134
ValueCheck(name="current"),
4235
]
4336

44-
self.expect_expr(
45-
"a",
46-
result_type=vector_type,
47-
result_children=[
48-
ValueCheck(children=[ValueCheck(value="3")]),
49-
ValueCheck(children=[ValueCheck(value="1")]),
50-
ValueCheck(children=[ValueCheck(value="2")]),
37+
self.expect(
38+
"expr a",
39+
patterns=[
40+
"""\(std::vector<Foo(, std::allocator<Foo> )*>\) \$0 = size=3 \{
41+
\[0\] = \(a = 3\)
42+
\[1\] = \(a = 1\)
43+
\[2\] = \(a = 2\)
44+
\}"""
5145
],
5246
)
5347

lldb/test/API/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,26 @@ def test(self):
1717
self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")
1818
)
1919

20-
if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
21-
[">", "16.0"]
22-
):
23-
vector_type = "std::vector<int>"
24-
vector_of_vector_type = "std::vector<std::vector<int> >"
25-
else:
26-
vector_type = "std::vector<int>"
27-
vector_of_vector_type = (
28-
"std::vector<std::vector<int>, std::allocator<std::vector<int> > >"
29-
)
30-
3120
size_type = "size_type"
3221
value_type = "value_type"
3322

3423
self.runCmd("settings set target.import-std-module true")
3524

36-
self.expect_expr(
37-
"a",
38-
result_type=vector_of_vector_type,
39-
result_children=[
40-
ValueCheck(
41-
type=vector_type,
42-
children=[
43-
ValueCheck(value="1"),
44-
ValueCheck(value="2"),
45-
ValueCheck(value="3"),
46-
],
47-
),
48-
ValueCheck(
49-
type=vector_type,
50-
children=[
51-
ValueCheck(value="3"),
52-
ValueCheck(value="2"),
53-
ValueCheck(value="1"),
54-
],
55-
),
25+
self.expect(
26+
"expr a",
27+
patterns=[
28+
"""\(std::vector<std::vector<int>(, std::allocator<std::vector<int> )* >\) \$0 = size=2 \{
29+
\[0\] = size=3 \{
30+
\[0\] = 1
31+
\[1\] = 2
32+
\[2\] = 3
33+
\}
34+
\[1\] = size=3 \{
35+
\[0\] = 3
36+
\[1\] = 2
37+
\[2\] = 1
38+
\}
39+
\}"""
5640
],
5741
)
5842
self.expect_expr("a.size()", result_type=size_type, result_value="2")

0 commit comments

Comments
 (0)