https://github.com/kusmour created 
https://github.com/llvm/llvm-project/pull/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.

>From 1d4160e68221ff90a7d01ab58f88eeb599882ef9 Mon Sep 17 00:00:00 2001
From: Wanyi Ye <wa...@meta.com>
Date: Fri, 17 Jan 2025 12:01:56 -0800
Subject: [PATCH] [lldb][test] Remove compiler version check and use regex

---
 .../TestDbgInfoContentVectorFromStdModule.py  | 22 +++------
 .../TestVectorOfVectorsFromStdModule.py       | 46 ++++++-------------
 2 files changed, 21 insertions(+), 47 deletions(-)

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..30e56f18a83d67 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,14 +34,13 @@ 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\)
+\}"""]
         )
 
         self.expect_expr("a.size()", result_type=size_type, result_value="3")
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..df9ff9316d549b 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,43 +17,25 @@ 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")
         front = self.expect_expr(

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to