Author: Pavel Labath
Date: 2021-11-15T11:12:05+01:00
New Revision: 5e20cd6568564025367b6a67424436c5d06fe3bc

URL: 
https://github.com/llvm/llvm-project/commit/5e20cd6568564025367b6a67424436c5d06fe3bc
DIFF: 
https://github.com/llvm/llvm-project/commit/5e20cd6568564025367b6a67424436c5d06fe3bc.diff

LOG: [lldb/test] Fix std-module vector tests to work with both kinds of vector 
layouts

D112976 changed the layout and 0d62e31c45 andjusted the test
expectations to match.

This patch changes the tests to expect both versions, so that one can
run the test suite against older libc++ versions as well.

Added: 
    

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

Removed: 
    


################################################################################
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 8c8dfe01a2deb..46633cacd6add 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
@@ -23,7 +23,6 @@ def test(self):
         vector_type = "std::vector<int>"
         vector_of_vector_type = "std::vector<" + vector_type + " >"
         size_type = vector_of_vector_type + "::size_type"
-        value_type = "std::vector<int>::value_type"
 
         self.runCmd("settings set target.import-std-module true")
 
@@ -45,9 +44,12 @@ def test(self):
                            ]),
             ])
         self.expect_expr("a.size()", result_type=size_type, result_value="2")
-        self.expect_expr("a.front().front()",
-                         result_type=value_type,
-                         result_value="1")
+        front = self.expect_expr("a.front().front()", result_value="1")
+        value_type = front.GetDisplayTypeName()
+        self.assertIn(value_type, [
+            "std::vector<int>::value_type", # Pre-D112976
+            "std::__vector_base<int, std::allocator<int> >::value_type", # 
Post-D112976
+            ])
         self.expect_expr("a[1][1]", result_type=value_type, result_value="2")
         self.expect_expr("a.back().at(0)",
                          result_type=value_type,

diff  --git 
a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
index 32a254ed218d7..1b93fa2664611 100644
--- 
a/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
+++ 
b/lldb/test/API/commands/expression/import-std-module/vector/TestVectorFromStdModule.py
@@ -24,7 +24,6 @@ def test(self):
 
         vector_type = "std::vector<int>"
         size_type = vector_type + "::size_type"
-        value_type = "std::vector<int>::value_type"
         iterator = vector_type + "::iterator"
         # LLDB's formatter provides us with a artificial 'item' member.
         iterator_children = [ValueCheck(name="item")]
@@ -42,7 +41,12 @@ def test(self):
                              ValueCheck(value="2")
                          ])
         self.expect_expr("a.size()", result_type=size_type, result_value="3")
-        self.expect_expr("a.front()", result_type=value_type, result_value="3")
+        front = self.expect_expr("a.front()", result_value="3")
+        value_type = front.GetDisplayTypeName()
+        self.assertIn(value_type, [
+            "std::vector<int>::value_type", # Pre-D112976
+            "std::__vector_base<int, std::allocator<int> >::value_type", # 
Post-D112976
+            ])
         self.expect_expr("a[1]", result_type=value_type, result_value="1")
         self.expect_expr("a.back()", result_type=value_type, result_value="2")
 


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

Reply via email to