Skip to content

Commit e14e982

Browse files
authored
[lldb][test] Combine libstdc++ and libc++ std::shared_ptr tests into generic test (#147141)
This combines the libc++ and libstdc++ test cases. The libstdcpp tests were a subset of the libc++ test, so this patch moves the libcxx test into `generic` and removes the libstdcpp test entirely. Split out from #146740
1 parent 22357fe commit e14e982

File tree

6 files changed

+13
-104
lines changed

6 files changed

+13
-104
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
CXX_SOURCES := main.cpp
22

3-
CXXFLAGS := -O0
4-
USE_LIBSTDCPP := 1
5-
63
include Makefile.rules
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Test lldb data formatter for libc++ std::shared_ptr.
2+
Test lldb data formatter for std::shared_ptr.
33
"""
44

55
import lldb
@@ -9,11 +9,8 @@
99

1010

1111
class TestCase(TestBase):
12-
@add_test_categories(["libc++"])
13-
def test_shared_ptr_variables(self):
12+
def do_test(self):
1413
"""Test `frame variable` output for `std::shared_ptr` types."""
15-
self.build()
16-
1714
(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint(
1815
self, "// break here", lldb.SBFileSpec("main.cpp")
1916
)
@@ -56,24 +53,16 @@ def test_shared_ptr_variables(self):
5653
self.assertRegex(valobj.summary, r"^10( strong=1)? weak=0$")
5754
self.assertNotEqual(valobj.child[0].unsigned, 0)
5855

59-
if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(
60-
[">", "16.0"]
61-
):
62-
string_type = "std::string"
63-
else:
64-
string_type = "std::basic_string<char, std::char_traits<char>, std::allocator<char> > "
65-
6656
valobj = self.expect_var_path(
6757
"sp_str",
68-
type="std::shared_ptr<" + string_type + ">",
6958
children=[ValueCheck(name="pointer", summary='"hello"')],
7059
)
7160
self.assertRegex(valobj.summary, r'^"hello"( strong=1)? weak=0$')
7261

7362
valobj = self.expect_var_path("sp_user", type="std::shared_ptr<User>")
7463
self.assertRegex(
7564
valobj.summary,
76-
"^std(::__[^:]*)?::shared_ptr<User>::element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=0",
65+
"element_type @ 0x0*[1-9a-f][0-9a-f]+( strong=1)? weak=0",
7766
)
7867
self.assertNotEqual(valobj.child[0].unsigned, 0)
7968

@@ -115,3 +104,13 @@ def test_shared_ptr_variables(self):
115104
self.expect_var_path("ptr_node->next->value", value="2")
116105
self.expect_var_path("(*ptr_node).value", value="1")
117106
self.expect_var_path("(*(*ptr_node).next).value", value="2")
107+
108+
@add_test_categories(["libc++"])
109+
def test_libcxx(self):
110+
self.build(dictionary={"USE_LIBCPP": 1})
111+
self.do_test()
112+
113+
@add_test_categories(["libstdcxx"])
114+
def test_libstdcxx(self):
115+
self.build(dictionary={"USE_LIBSTDCPP": 1})
116+
self.do_test()

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/Makefile

Lines changed: 0 additions & 8 deletions
This file was deleted.

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py

Lines changed: 0 additions & 53 deletions
This file was deleted.

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)