[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.
This commit is contained in:
Pavel Labath 2021-11-15 11:07:43 +01:00
parent 91f4650ebb
commit 5e20cd6568
2 changed files with 12 additions and 6 deletions

View File

@ -23,7 +23,6 @@ class TestVectorOfVectors(TestBase):
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 @@ class TestVectorOfVectors(TestBase):
]),
])
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,

View File

@ -24,7 +24,6 @@ class TestBasicVector(TestBase):
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 @@ class TestBasicVector(TestBase):
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")