Skip to content

Commit b0444b0

Browse files
authored
[lldb][test] Turn std::atomic libcxx test generic (#146843)
Split out from #146740
1 parent 31bdd5f commit b0444b0

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
CXX_SOURCES := main.cpp
2-
CXXFLAGS_EXTRAS := -std=c++11
3-
USE_LIBCPP := 1
42

53
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: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@
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

19-
@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()
19+
def do_test(self):
20+
"""Test that std::atomic is correctly printed by LLDB"""
2421
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
2522

2623
bkpt = self.target().FindBreakpointByID(
@@ -31,8 +28,6 @@ def test(self):
3128

3229
self.runCmd("run", RUN_SUCCEEDED)
3330

34-
lldbutil.skip_if_library_missing(self, self.target(), re.compile(r"libc\+\+"))
35-
3631
# The stop reason of the thread should be breakpoint.
3732
self.expect(
3833
"thread list",
@@ -66,3 +61,9 @@ def test(self):
6661
self.expect(
6762
"frame var p.child.parent", substrs=["p.child.parent = {\n Value = 0x"]
6863
)
64+
65+
@skipIf(compiler=["gcc"])
66+
@add_test_categories(["libc++"])
67+
def test_libcxx(self):
68+
self.build(dictionary={"USE_LIBCPP": 1})
69+
self.do_test()

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/main.cpp renamed to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,26 @@ struct Child {
66
// This should point to the parent which in turn owns this
77
// child instance. This cycle should not cause LLDB to infinite loop
88
// during printing.
9-
std::atomic<Parent*> parent{nullptr};
9+
std::atomic<Parent *> parent{nullptr};
1010
};
1111
struct Parent {
1212
Child child;
1313
};
1414

1515
struct S {
16-
int x = 1;
17-
int y = 2;
16+
int x = 1;
17+
int y = 2;
1818
};
1919

20-
int main ()
21-
{
22-
std::atomic<S> s;
23-
s.store(S());
24-
std::atomic<int> i;
25-
i.store(5);
20+
int main() {
21+
std::atomic<S> s;
22+
s.store(S());
23+
std::atomic<int> i;
24+
i.store(5);
2625

27-
Parent p;
28-
// Let the child node know what its parent is.
29-
p.child.parent = &p;
26+
Parent p;
27+
// Let the child node know what its parent is.
28+
p.child.parent = &p;
3029

31-
return 0; // Set break point at this line.
30+
return 0; // Set break point at this line.
3231
}
33-

0 commit comments

Comments
 (0)