Skip to content

Commit f1cee58

Browse files
authored
[lldb][test] Combine libstdc++ and libc++ iterator tests into generic test (#147175)
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. There are currently no formatters for libstdcpp std::unorderd_map::iterator. So I removed those test-cases. We already test them for libc++ in `libcxx/unordered_map-iterator`. And we test `std::unordered_map` in `generic/unorderd`. So these test-cases would be redundant. Split out from #146740
1 parent e908f61 commit f1cee58

File tree

6 files changed

+12
-141
lines changed

6 files changed

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

3-
USE_LIBCPP := 1
4-
5-
CXXFLAGS_EXTRAS := -O0
63
include Makefile.rules
Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,22 @@
22
Test lldb data formatter subsystem.
33
"""
44

5-
65
import lldb
76
from lldbsuite.test.decorators import *
87
from lldbsuite.test.lldbtest import *
98
from lldbsuite.test import lldbutil
109

1110

12-
class LibcxxIteratorDataFormatterTestCase(TestBase):
11+
class StdIteratorDataFormatterTestCase(TestBase):
1312
def setUp(self):
1413
# Call super's setUp().
1514
TestBase.setUp(self)
1615
# Find the line number to break at.
1716
self.line = line_number("main.cpp", "// Set break point at this line.")
1817
self.namespace = "std"
1918

20-
@add_test_categories(["libc++"])
21-
def test_with_run_command(self):
22-
"""Test that libc++ iterators format properly."""
23-
self.build()
19+
def do_test(self):
20+
"""Test that iterators format properly."""
2421
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
2522

2623
lldbutil.run_break_set_by_file_and_line(
@@ -69,18 +66,12 @@ def cleanup():
6966
self.expect("frame variable svI", substrs=['item = "hello"'])
7067
self.expect("expr svI", substrs=['item = "hello"'])
7168

72-
self.expect("frame variable iiumI", substrs=["first = 61453", "second = 51966"])
73-
self.expect("expr iiumI", substrs=["first = 61453", "second = 51966"])
74-
75-
self.expect("frame variable siumI", substrs=['first = "hello"', "second = 137"])
76-
self.expect("expr siumI", substrs=['first = "hello"', "second = 137"])
77-
78-
self.expect("frame variable iiumI.first", substrs=["first = 61453"])
79-
self.expect("frame variable iiumI.first", substrs=["second"], matching=False)
80-
self.expect("frame variable iiumI.second", substrs=["second = 51966"])
81-
self.expect("frame variable iiumI.second", substrs=["first"], matching=False)
82-
83-
self.expect("frame variable siumI.first", substrs=['first = "hello"'])
84-
self.expect("frame variable siumI.first", substrs=["second"], matching=False)
85-
self.expect("frame variable siumI.second", substrs=["second = 137"])
86-
self.expect("frame variable siumI.second", substrs=["first"], matching=False)
69+
@add_test_categories(["libc++"])
70+
def test_libcxx(self):
71+
self.build(dictionary={"USE_LIBCPP": 1})
72+
self.do_test()
73+
74+
@add_test_categories(["libstdcxx"])
75+
def test_libstdcxx(self):
76+
self.build(dictionary={"USE_LIBSTDCPP": 1})
77+
self.do_test()

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@
55
typedef std::map<int, int> intint_map;
66
typedef std::map<std::string, int> strint_map;
77

8-
typedef std::unordered_map<int, int> intint_umap;
9-
typedef std::unordered_map<std::string, int> strint_umap;
10-
118
typedef std::vector<int> int_vector;
129
typedef std::vector<std::string> string_vector;
1310

1411
typedef intint_map::iterator ii_map_iter;
1512
typedef strint_map::iterator si_map_iter;
16-
typedef intint_umap::iterator ii_umap_iter;
17-
typedef strint_umap::iterator si_umap_iter;
1813

1914
typedef int_vector::iterator ivter;
2015
typedef string_vector::iterator svter;
@@ -26,12 +21,6 @@ int main() {
2621
strint_map sim;
2722
sim["world"] = 42;
2823

29-
intint_umap iium;
30-
iium[0xF00D] = 0xCAFE;
31-
32-
strint_umap sium;
33-
sium["hello"] = 137;
34-
3524
int_vector iv;
3625
iv.push_back(3);
3726

@@ -40,8 +29,6 @@ int main() {
4029

4130
ii_map_iter iimI = iim.begin();
4231
si_map_iter simI = sim.begin();
43-
ii_umap_iter iiumI = iium.begin();
44-
si_umap_iter siumI = sium.begin();
4532

4633
ivter ivI = iv.begin();
4734
svter svI = sv.begin();

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile

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

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py

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

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

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

0 commit comments

Comments
 (0)