Skip to content

Commit 1034c77

Browse files
committed
[lldb][test] Combine libstdc++ and libc++ std::shared_ptr tests into generic test (llvm#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 llvm#146740 (cherry picked from commit e14e982)
1 parent a05db4d commit 1034c77

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

@@ -109,3 +98,13 @@ def test_shared_ptr_variables(self):
10998
valobj = self.expect_var_path(
11099
"wie", type="std::weak_ptr<int>", summary="nullptr strong=2 weak=2"
111100
)
101+
102+
@add_test_categories(["libc++"])
103+
def test_libcxx(self):
104+
self.build(dictionary={"USE_LIBCPP": 1})
105+
self.do_test()
106+
107+
@add_test_categories(["libstdcxx"])
108+
def test_libstdcxx(self):
109+
self.build(dictionary={"USE_LIBSTDCPP": 1})
110+
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)