Skip to content

Commit 80c6190

Browse files
committed
[lldb][test] Turn (most) libcxx data-formatters tests into generic tests
This patch moves all the data-formatter tests that were only run for libc++ to the generic directory. There's nothing libc++ specific about these tests. For aynthing tied to libcxx we can have a dedicated subdirectory. But for now lets move as much into `generic` as possible. This involved renaming a bunch of files and passing the `USE_LIBCPP` and `USE_LIBSTDCPP` Makefile variables from within the python test-cases instead of the Makefiles. This is how the existing `generic` tests already worked. The only tests I haven't turned into "generic" ones are the ones for `std::string`. Next steps: 1. Move libstdcpp tests into the `generic` directory 2. Move as much of the `std::string` libc++ tests into `generic`
1 parent 68173c8 commit 80c6190

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+341
-134
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
CXX_SOURCES := main.cpp
22
CXXFLAGS_EXTRAS := -std=c++11
3-
USE_LIBCPP := 1
43

54
include Makefile.rules

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py renamed to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,16 @@
99
from lldbsuite.test import lldbutil
1010

1111

12-
class LibCxxAtomicTestCase(TestBase):
12+
class StdAtomicTestCase(TestBase):
1313
def get_variable(self, name):
1414
var = self.frame().FindVariable(name)
1515
var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
1616
var.SetPreferSyntheticValue(True)
1717
return var
1818

1919
@skipIf(compiler=["gcc"])
20-
@add_test_categories(["libc++"])
21-
def test(self):
22-
"""Test that std::atomic as defined by libc++ is correctly printed by LLDB"""
23-
self.build()
20+
def do_test(self):
21+
"""Test that std::atomic is correctly printed by LLDB"""
2422
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
2523

2624
bkpt = self.target().FindBreakpointByID(
@@ -66,3 +64,13 @@ def test(self):
6664
self.expect(
6765
"frame var p.child.parent", substrs=["p.child.parent = {\n Value = 0x"]
6866
)
67+
68+
@add_test_categories(["libc++"])
69+
def test_libcxx(self):
70+
self.build(dictionary={"USE_LIBCPP" : 1})
71+
self.do_test()
72+
73+
@add_test_categories(["libstdcxx"])
74+
def test_libstdcxx(self):
75+
self.build(dictionary={"USE_LIBSTDCPP" : 1})
76+
self.do_test()
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
CXX_SOURCES := main.cpp
22

3-
USE_LIBCPP := 1
4-
53
CXXFLAGS_EXTRAS := -std=c++20
64
include Makefile.rules
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
from lldbsuite.test import lldbutil
1010

1111

12-
class LibcxxChronoDataFormatterTestCase(TestBase):
13-
@add_test_categories(["libc++"])
12+
class StdChronoDataFormatterTestCase(TestBase):
1413
@skipIf(compiler="clang", compiler_version=["<", "17.0"])
15-
def test_with_run_command(self):
14+
def do_test(self):
1615
"""Test that that file and class static variables display correctly."""
1716
isNotWindowsHost = lldbplatformutil.getHostPlatform() != "windows"
18-
self.build()
1917
(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
2018
self, "break here", lldb.SBFileSpec("main.cpp", False)
2119
)
@@ -433,3 +431,13 @@ def test_with_run_command(self):
433431
"ymwdl_2024_last_tuesday_january = year=2024 month=January weekday=Tuesday index=last"
434432
],
435433
)
434+
435+
@add_test_categories(["libc++"])
436+
def test_libcxx(self):
437+
self.build(dictionary={"USE_LIBCPP" : 1})
438+
self.do_test()
439+
440+
@add_test_categories(["libstdcxx"])
441+
def test_libstdcxx(self):
442+
self.build(dictionary={"USE_LIBSTDCPP" : 1})
443+
self.do_test()
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
CXX_SOURCES := main.cpp
22
CXXFLAGS_EXTRAS := -std=c++11
3-
USE_LIBCPP := 1
43

54
include Makefile.rules

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py renamed to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from lldbsuite.test import lldbutil
1010

1111

12-
class LibCxxFunctionTestCase(TestBase):
12+
class StdFunctionTestCase(TestBase):
1313
# Run frame var for a variable twice. Verify we do not hit the cache
1414
# the first time but do the second time.
1515
def run_frame_var_check_cache_use(
@@ -34,10 +34,8 @@ def run_frame_var_check_cache_use(
3434
substrs=["lldb_private::CompileUnit::FindFunction"],
3535
)
3636

37-
@add_test_categories(["libc++"])
38-
def test(self):
39-
"""Test that std::function as defined by libc++ is correctly printed by LLDB"""
40-
self.build()
37+
def do_test(self):
38+
"""Test that std::function is correctly printed by LLDB"""
4139
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
4240

4341
bkpt = self.target().FindBreakpointByID(
@@ -82,3 +80,13 @@ def test(self):
8280
self.expect(
8381
"frame variable f5", substrs=["f5 = Function = Bar::add_num(int) const"]
8482
)
83+
84+
@add_test_categories(["libc++"])
85+
def test_libcxx(self):
86+
self.build(dictionary={"USE_LIBCPP" : 1})
87+
self.do_test()
88+
89+
@add_test_categories(["libstdcxx"])
90+
def test_libstdcxx(self):
91+
self.build(dictionary={"USE_LIBSTDCPP" : 1})
92+
self.do_test()
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
CXX_SOURCES := main.cpp
22

3-
USE_LIBCPP := 1
43
include Makefile.rules

0 commit comments

Comments
 (0)