https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/146740
>From 66a4fdb156d493bf994fd5c0050cfd2d7352732d Mon Sep 17 00:00:00 2001 From: Michael Buch <michaelbuc...@gmail.com> Date: Wed, 2 Jul 2025 15:01:27 +0100 Subject: [PATCH 1/3] [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` --- .../{libcxx => generic}/atomic/Makefile | 1 - .../atomic/TestDataFormatterStdAtomic.py} | 18 +++-- .../{libcxx => generic}/atomic/main.cpp | 0 .../{libcxx => generic}/chrono/Makefile | 2 - .../chrono/TestDataFormatterStdChrono.py} | 16 +++- .../{libcxx => generic}/chrono/main.cpp | 0 .../{libcxx => generic}/function/Makefile | 1 - .../function/TestDataFormatterStdFunction.py} | 18 +++-- .../{libcxx => generic}/function/main.cpp | 0 .../initializerlist}/Makefile | 1 - .../TestDataFormatterStdInitializerList.py} | 16 +++- .../initializerlist/main.cpp | 0 .../iterator}/Makefile | 2 - .../iterator/TestDataFormatterIterator.py} | 18 +++-- .../{libcxx => generic}/iterator/main.cpp | 0 .../{libcxx/tuple => generic/map}/Makefile | 1 - .../map/TestDataFormatterMap.py} | 16 +++- .../{libcxx => generic}/map/main.cpp | 0 .../{libcxx/vbool => generic/queue}/Makefile | 3 +- .../queue/TestDataFormatterStdQueue.py} | 16 +++- .../{libcxx => generic}/queue/main.cpp | 0 .../span => generic/ranges/ref_view}/Makefile | 3 - .../TestDataFormatterLibcxxRangesRefView.py | 16 +++- .../TestDataFormatterStdRangesRefView.py | 79 +++++++++++++++++++ .../ranges/ref_view/main.cpp | 0 .../set/TestDataFormatterGenericSet.py | 2 +- .../{libcxx => generic}/shared_ptr/Makefile | 2 - .../TestDataFormatterStdSharedPtr.py} | 17 ++-- .../{libcxx => generic}/shared_ptr/main.cpp | 0 .../ranges/ref_view => generic/span}/Makefile | 3 +- .../span/TestDataFormatterStdSpan.py} | 32 ++++++-- .../{libcxx => generic}/span/main.cpp | 0 .../{libcxx => generic}/string_view/Makefile | 2 - .../TestDataFormatterStdStringView.py} | 26 ++++-- .../{libcxx => generic}/string_view/main.cpp | 0 .../valarray => generic/tuple}/Makefile | 2 - .../tuple/TestDataFormatterTuple.py} | 16 +++- .../{libcxx => generic}/tuple/main.cpp | 0 .../{libcxx => generic}/unique_ptr/Makefile | 2 - .../unique_ptr/TestDataFormatterUniquePtr.py} | 17 ++-- .../{libcxx => generic}/unique_ptr/main.cpp | 0 .../generic/unordered_map-iterator/Makefile | 3 + ...stDataFormatterStdUnorderedMapIterator.py} | 16 +++- .../unordered_map-iterator/main.cpp | 0 .../generic/valarray/Makefile | 3 + .../valarray/TestDataFormatterStdValarray.py} | 16 +++- .../{libcxx => generic}/valarray/main.cpp | 0 .../{libcxx => generic}/variant/Makefile | 2 - .../variant/TestDataFormatterStdVariant.py} | 16 +++- .../{libcxx => generic}/variant/main.cpp | 0 .../data-formatter-stl/generic/vbool/Makefile | 3 + .../vbool/TestDataFormatterVBool.py} | 16 +++- .../{libcxx => generic}/vbool/main.cpp | 0 .../generic/vector/Makefile | 3 + .../vector/TestDataFormatterVector.py} | 28 +++++-- .../{libcxx => generic}/vector/main.cpp | 0 .../libcxx/initializerlist/Makefile | 6 -- .../libcxx/iterator/Makefile | 6 -- .../data-formatter-stl/libcxx/map/Makefile | 6 -- .../data-formatter-stl/libcxx/vector/Makefile | 6 -- 60 files changed, 342 insertions(+), 136 deletions(-) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/atomic/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/atomic/TestLibCxxAtomic.py => generic/atomic/TestDataFormatterStdAtomic.py} (85%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/atomic/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/chrono/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/chrono/TestDataFormatterLibcxxChrono.py => generic/chrono/TestDataFormatterStdChrono.py} (98%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/chrono/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/function/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/function/TestLibCxxFunction.py => generic/function/TestDataFormatterStdFunction.py} (87%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/function/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/queue => generic/initializerlist}/Makefile (75%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/initializerlist/TestInitializerList.py => generic/initializerlist/TestDataFormatterStdInitializerList.py} (78%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/initializerlist/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/unordered_map-iterator => generic/iterator}/Makefile (80%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/iterator/TestDataFormatterLibccIterator.py => generic/iterator/TestDataFormatterIterator.py} (90%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/iterator/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/tuple => generic/map}/Makefile (75%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/map/TestDataFormatterLibccMap.py => generic/map/TestDataFormatterMap.py} (97%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/map/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/vbool => generic/queue}/Makefile (75%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/queue/TestDataFormatterLibcxxQueue.py => generic/queue/TestDataFormatterStdQueue.py} (77%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/queue/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/span => generic/ranges/ref_view}/Makefile (81%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py (87%) create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/ranges/ref_view/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/shared_ptr/Makefile (92%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py => generic/shared_ptr/TestDataFormatterStdSharedPtr.py} (91%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/shared_ptr/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/ranges/ref_view => generic/span}/Makefile (83%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/span/TestDataFormatterLibcxxSpan.py => generic/span/TestDataFormatterStdSpan.py} (88%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/span/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/string_view/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/string_view/TestDataFormatterLibcxxStringView.py => generic/string_view/TestDataFormatterStdStringView.py} (93%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/string_view/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/valarray => generic/tuple}/Makefile (73%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/tuple/TestDataFormatterLibcxxTuple.py => generic/tuple/TestDataFormatterTuple.py} (77%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/tuple/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/unique_ptr/Makefile (92%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py => generic/unique_ptr/TestDataFormatterUniquePtr.py} (93%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/unique_ptr/main.cpp (100%) create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py => generic/unordered_map-iterator/TestDataFormatterStdUnorderedMapIterator.py} (91%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/unordered_map-iterator/main.cpp (100%) create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/Makefile rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/valarray/TestDataFormatterLibcxxValarray.py => generic/valarray/TestDataFormatterStdValarray.py} (94%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/valarray/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/variant/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/variant/TestDataFormatterLibcxxVariant.py => generic/variant/TestDataFormatterStdVariant.py} (89%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/variant/main.cpp (100%) create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/Makefile rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/vbool/TestDataFormatterLibcxxVBool.py => generic/vbool/TestDataFormatterVBool.py} (87%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/vbool/main.cpp (100%) create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/Makefile rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/vector/TestDataFormatterLibcxxVector.py => generic/vector/TestDataFormatterVector.py} (90%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/vector/main.cpp (100%) delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/Makefile similarity index 82% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/Makefile index b016f006747da..e78030cbf7528 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/Makefile @@ -1,5 +1,4 @@ CXX_SOURCES := main.cpp CXXFLAGS_EXTRAS := -std=c++11 -USE_LIBCPP := 1 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py similarity index 85% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py index c6592ede03147..87e7541dbfe24 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py @@ -9,7 +9,7 @@ from lldbsuite.test import lldbutil -class LibCxxAtomicTestCase(TestBase): +class StdAtomicTestCase(TestBase): def get_variable(self, name): var = self.frame().FindVariable(name) var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) @@ -17,10 +17,8 @@ def get_variable(self, name): return var @skipIf(compiler=["gcc"]) - @add_test_categories(["libc++"]) - def test(self): - """Test that std::atomic as defined by libc++ is correctly printed by LLDB""" - self.build() + def do_test(self): + """Test that std::atomic is correctly printed by LLDB""" self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) bkpt = self.target().FindBreakpointByID( @@ -66,3 +64,13 @@ def test(self): self.expect( "frame var p.child.parent", substrs=["p.child.parent = {\n Value = 0x"] ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/Makefile similarity index 82% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/Makefile index 57540fc1a2816..ac12cb120f853 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/Makefile @@ -1,6 +1,4 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 - CXXFLAGS_EXTRAS := -std=c++20 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py similarity index 98% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py index 0737a5bc7e6eb..626633e322b14 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py @@ -9,13 +9,11 @@ from lldbsuite.test import lldbutil -class LibcxxChronoDataFormatterTestCase(TestBase): - @add_test_categories(["libc++"]) +class StdChronoDataFormatterTestCase(TestBase): @skipIf(compiler="clang", compiler_version=["<", "17.0"]) - def test_with_run_command(self): + def do_test(self): """Test that that file and class static variables display correctly.""" isNotWindowsHost = lldbplatformutil.getHostPlatform() != "windows" - self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp", False) ) @@ -433,3 +431,13 @@ def test_with_run_command(self): "ymwdl_2024_last_tuesday_january = year=2024 month=January weekday=Tuesday index=last" ], ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/Makefile similarity index 82% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/Makefile index b016f006747da..e78030cbf7528 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/Makefile @@ -1,5 +1,4 @@ CXX_SOURCES := main.cpp CXXFLAGS_EXTRAS := -std=c++11 -USE_LIBCPP := 1 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py similarity index 87% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py index 80461b996328f..8f68afb91af27 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py @@ -9,7 +9,7 @@ from lldbsuite.test import lldbutil -class LibCxxFunctionTestCase(TestBase): +class StdFunctionTestCase(TestBase): # Run frame var for a variable twice. Verify we do not hit the cache # the first time but do the second time. def run_frame_var_check_cache_use( @@ -34,10 +34,8 @@ def run_frame_var_check_cache_use( substrs=["lldb_private::CompileUnit::FindFunction"], ) - @add_test_categories(["libc++"]) - def test(self): - """Test that std::function as defined by libc++ is correctly printed by LLDB""" - self.build() + def do_test(self): + """Test that std::function is correctly printed by LLDB""" self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) bkpt = self.target().FindBreakpointByID( @@ -82,3 +80,13 @@ def test(self): self.expect( "frame variable f5", substrs=["f5 = Function = Bar::add_num(int) const"] ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/Makefile similarity index 75% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/Makefile index 680e1abfbef58..99998b20bcb05 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/Makefile @@ -1,4 +1,3 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/TestDataFormatterStdInitializerList.py similarity index 78% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/TestDataFormatterStdInitializerList.py index b8a1dd3569d77..b37b043f3a3a4 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/TestDataFormatterStdInitializerList.py @@ -10,11 +10,9 @@ from lldbsuite.test import lldbutil -class InitializerListTestCase(TestBase): - @add_test_categories(["libc++"]) - def test(self): +class StdInitializerListTestCase(TestBase): + def do_test(self): """Test that that file and class static variables display correctly.""" - self.build() self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) bkpt = self.target().FindBreakpointByID( @@ -39,3 +37,13 @@ def test(self): "frame variable ils", substrs=['[4] = "surprise it is a long string!! yay!!"'], ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/Makefile similarity index 80% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/Makefile index 564cbada74e08..a149c7f81bfab 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/Makefile @@ -1,6 +1,4 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 - CXXFLAGS_EXTRAS := -O0 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterIterator.py similarity index 90% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterIterator.py index c43ee46fb658a..eff4aaac7b031 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterIterator.py @@ -9,7 +9,7 @@ from lldbsuite.test import lldbutil -class LibcxxIteratorDataFormatterTestCase(TestBase): +class StdIteratorDataFormatterTestCase(TestBase): def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -17,10 +17,8 @@ def setUp(self): self.line = line_number("main.cpp", "// Set break point at this line.") self.namespace = "std" - @add_test_categories(["libc++"]) - def test_with_run_command(self): - """Test that libc++ iterators format properly.""" - self.build() + def do_test(self): + """Test that STL iterators format properly.""" self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( @@ -84,3 +82,13 @@ def cleanup(): self.expect("frame variable siumI.first", substrs=["second"], matching=False) self.expect("frame variable siumI.second", substrs=["second = 137"]) self.expect("frame variable siumI.second", substrs=["first"], matching=False) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/Makefile similarity index 75% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/Makefile index 680e1abfbef58..99998b20bcb05 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/Makefile @@ -1,4 +1,3 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/TestDataFormatterMap.py similarity index 97% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/TestDataFormatterMap.py index b2b83a3b46114..c6ae24e8992cf 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/TestDataFormatterMap.py @@ -9,7 +9,7 @@ from lldbsuite.test import lldbutil -class LibcxxMapDataFormatterTestCase(TestBase): +class StdMapDataFormatterTestCase(TestBase): def setUp(self): TestBase.setUp(self) ns = "ndk" if lldbplatformutil.target_is_android() else "" @@ -22,10 +22,8 @@ def check_pair(self, first_value, second_value): ] return ValueCheck(children=pair_children) - @add_test_categories(["libc++"]) - def test_with_run_command(self): + def do_test(self): """Test that that file and class static variables display correctly.""" - self.build() self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) bkpt = self.target().FindBreakpointByID( @@ -326,3 +324,13 @@ def cleanup(): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable ss", substrs=["%s::map" % ns, "size=0", "{}"]) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/Makefile similarity index 75% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/Makefile index d87cf7d402787..99998b20bcb05 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/Makefile @@ -1,4 +1,3 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 -include Makefile.rules +include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py similarity index 77% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py index 53eaf5a23cc07..02898ffa0d881 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py @@ -9,7 +9,7 @@ from lldbsuite.test import lldbutil -class TestDataFormatterLibcxxQueue(TestBase): +class TestDataFormatterStdQueue(TestBase): def setUp(self): TestBase.setUp(self) self.namespace = "std" @@ -29,13 +29,21 @@ def check_variable(self, name): @expectedFailureAll( bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android" ) - @add_test_categories(["libc++"]) - def test(self): + def do_test(self): """Test that std::queue is displayed correctly""" - self.build() lldbutil.run_to_source_breakpoint( self, "// break here", lldb.SBFileSpec("main.cpp", False) ) self.check_variable("q1") self.check_variable("q2") + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/Makefile similarity index 81% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/Makefile index 20c9cf06b1a63..4f79c0a900c3a 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/Makefile @@ -1,7 +1,4 @@ CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 - CXXFLAGS_EXTRAS := -std=c++20 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py similarity index 87% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py index 9b5194be91e78..5603435168247 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py @@ -8,7 +8,7 @@ from lldbsuite.test import lldbutil -class LibcxxRangesRefViewDataFormatterTestCase(TestBase): +class StdRangesRefViewDataFormatterTestCase(TestBase): def check_string_vec_children(self): return [ ValueCheck(name="[0]", summary='"First"'), @@ -27,12 +27,10 @@ def check_string_vec_ref_view(self): def check_foo(self): return ValueCheck(name="vec", children=self.check_string_vec_children()) - @add_test_categories(["libc++"]) @skipIf(compiler=no_match("clang")) @skipIf(compiler="clang", compiler_version=["<", "16.0"]) - def test_with_run_command(self): + def do_test(self): """Test that std::ranges::ref_view is formatted correctly when printed.""" - self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "Break here", lldb.SBFileSpec("main.cpp", False) ) @@ -69,3 +67,13 @@ def test_with_run_command(self): ) ], ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcpp(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py new file mode 100644 index 0000000000000..5603435168247 --- /dev/null +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py @@ -0,0 +1,79 @@ +""" +Test LLDB's std::ranges::ref_view formatter +""" + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class StdRangesRefViewDataFormatterTestCase(TestBase): + def check_string_vec_children(self): + return [ + ValueCheck(name="[0]", summary='"First"'), + ValueCheck(name="[1]", summary='"Second"'), + ValueCheck(name="[2]", summary='"Third"'), + ValueCheck(name="[3]", summary='"Fourth"'), + ] + + def check_string_vec_ref_view(self): + return ValueCheck( + name="*__range_", + summary="size=4", + children=self.check_string_vec_children(), + ) + + def check_foo(self): + return ValueCheck(name="vec", children=self.check_string_vec_children()) + + @skipIf(compiler=no_match("clang")) + @skipIf(compiler="clang", compiler_version=["<", "16.0"]) + def do_test(self): + """Test that std::ranges::ref_view is formatted correctly when printed.""" + (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, "Break here", lldb.SBFileSpec("main.cpp", False) + ) + + # Check ref_view over a std::string + self.expect_var_path( + "single", children=[ValueCheck(name="*__range_", summary='"First"')] + ) + + # Check all_view, which is a ref_view in this case + self.expect_var_path("all", children=[self.check_string_vec_ref_view()]) + + # Check take_view format. Embeds a ref_view + self.expect_var_path( + "subset", + children=[ + ValueCheck(children=[self.check_string_vec_ref_view()]), + ValueCheck(name="__count_", value="2"), + ], + ) + + lldbutil.continue_to_breakpoint(self.process(), bkpt) + + # Check ref_view over custom type 'struct Foo' + self.expect_var_path( + "view", + children=[ + ValueCheck( + name="*__range_", + children=[ + ValueCheck(name="[0]", type="Foo", children=[self.check_foo()]), + ValueCheck(name="[1]", type="Foo", children=[self.check_foo()]), + ], + ) + ], + ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcpp(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/ranges/ref_view/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/ranges/ref_view/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py index 03e18ff4335e5..d3d6ef55c6ff0 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py @@ -137,7 +137,7 @@ def test_with_run_command_libcpp(self): def do_test_ref_and_ptr(self, stdlib_type): """Test that the data formatters work on ref and ptr.""" - self.build() + self.build(dictionary={stdlib_type: "1"}) (self.target, process, _, bkpt) = lldbutil.run_to_source_breakpoint( self, "Stop here to check by ref and ptr.", diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/Makefile similarity index 92% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/Makefile index c1c8b4a2a0a53..ece665a0fd5b7 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/Makefile @@ -1,7 +1,5 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 - # We need debug info tuning for lldb in order to emit the preferred name for # std::string. See https://reviews.llvm.org/D145803. CXXFLAGS_EXTRAS := -std=c++14 -glldb diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/TestDataFormatterStdSharedPtr.py similarity index 91% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/TestDataFormatterStdSharedPtr.py index 61c050b3bfa01..e2c04ec059f2b 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/TestDataFormatterStdSharedPtr.py @@ -1,5 +1,5 @@ """ -Test lldb data formatter for libc++ std::shared_ptr. +Test lldb data formatter for std::shared_ptr. """ @@ -10,11 +10,8 @@ class TestCase(TestBase): - @add_test_categories(["libc++"]) - def test_shared_ptr_variables(self): + def do_test(self): """Test `frame variable` output for `std::shared_ptr` types.""" - self.build() - lldbutil.run_to_source_breakpoint( self, "// break here", lldb.SBFileSpec("main.cpp") ) @@ -96,3 +93,13 @@ def test_shared_ptr_variables(self): self.expect_var_path("ptr_node->next->value", value="2") self.expect_var_path("(*ptr_node).value", value="1") self.expect_var_path("(*(*ptr_node).next).value", value="2") + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/ranges/ref_view/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/Makefile similarity index 83% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/ranges/ref_view/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/Makefile index 3c4f9b45f41de..344f9e1d7fd7b 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/ranges/ref_view/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/Makefile @@ -1,6 +1,5 @@ -USE_LIBCPP := 1 - CXX_SOURCES := main.cpp + CXXFLAGS_EXTRAS := -std=c++20 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/TestDataFormatterLibcxxSpan.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py similarity index 88% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/TestDataFormatterLibcxxSpan.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py index 42efe415b6acf..cfef1cad3d295 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/TestDataFormatterLibcxxSpan.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py @@ -8,7 +8,7 @@ from lldbsuite.test import lldbutil -class LibcxxSpanDataFormatterTestCase(TestBase): +class StdSpanDataFormatterTestCase(TestBase): def findVariable(self, name): var = self.frame().FindVariable(name) self.assertTrue(var.IsValid()) @@ -44,11 +44,8 @@ def check_numbers(self, var_name): self.expect_var_path(f"{var_name}[3]", type="int", value="1234") self.expect_var_path(f"{var_name}[4]", type="int", value="12345") - @add_test_categories(["libc++"]) - @skipIf(compiler="clang", compiler_version=["<", "11.0"]) - def test_with_run_command(self): + def do_test(self): """Test that std::span variables are formatted correctly when printed.""" - self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp", False) ) @@ -160,9 +157,18 @@ def test_with_run_command(self): @add_test_categories(["libc++"]) @skipIf(compiler="clang", compiler_version=["<", "11.0"]) - def test_ref_and_ptr(self): + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + @skipIf(compiler="clang", compiler_version=["<", "11.0"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() + + def do_test_ref_and_ptr(self): """Test that std::span is correctly formatted when passed by ref and ptr""" - self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "Stop here to check by ref", lldb.SBFileSpec("main.cpp", False) ) @@ -173,3 +179,15 @@ def test_ref_and_ptr(self): # The pointer should just show the right number of elements: self.expect("frame variable ptr", patterns=["ptr = 0x[0-9a-f]+ size=5"]) + + @add_test_categories(["libc++"]) + @skipIf(compiler="clang", compiler_version=["<", "11.0"]) + def test_ref_and_ptr_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test_ref_and_ptr() + + @add_test_categories(["libstdcxx"]) + @skipIf(compiler="clang", compiler_version=["<", "11.0"]) + def test_ref_and_ptr_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test_ref_and_ptr() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/Makefile similarity index 82% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/Makefile index c7c91da728d1e..7025148aa9eb5 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/Makefile @@ -1,6 +1,4 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 - CXXFLAGS_EXTRAS := -std=c++11 -O0 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/TestDataFormatterStdStringView.py similarity index 93% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/TestDataFormatterStdStringView.py index 3883395f23924..0df3686127b71 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/TestDataFormatterLibcxxStringView.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/TestDataFormatterStdStringView.py @@ -10,7 +10,7 @@ from lldbsuite.test import lldbutil -class LibcxxStringViewDataFormatterTestCase(TestBase): +class StdStringViewDataFormatterTestCase(TestBase): def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -20,16 +20,10 @@ def setUp(self): "main.cpp", "// Break here to look at bad string view." ) - @add_test_categories(["libc++"]) - @expectedFailureAll( - bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android" - ) # Inline namespace is randomly ignored as Clang due to broken lookup inside # the std namespace. - @expectedFailureAll(debug_info="gmodules") - def test_with_run_command(self): + def do_test(self): """Test that that file and class static variables display correctly.""" - self.build() self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( @@ -160,3 +154,19 @@ def cleanup(): broken_obj = self.frame().GetValueForVariablePath("in_str_view") self.assertEqual(broken_obj.GetSummary(), "Summary Unavailable") + + @expectedFailureAll( + bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android" + ) + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @expectedFailureAll( + bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android" + ) + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/Makefile similarity index 73% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/Makefile index c5df567e01a2a..99998b20bcb05 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/Makefile @@ -1,5 +1,3 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 - include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/TestDataFormatterTuple.py similarity index 77% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/TestDataFormatterTuple.py index 5b6dfaf5e5d9d..34b747cdbe291 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/TestDataFormatterTuple.py @@ -9,16 +9,14 @@ from lldbsuite.test import lldbutil -class TestDataFormatterLibcxxTuple(TestBase): +class TestDataFormatterStdTuple(TestBase): def setUp(self): TestBase.setUp(self) self.line = line_number("main.cpp", "// break here") self.namespace = "std" - @add_test_categories(["libc++"]) - def test(self): + def do_test(self): """Test that std::tuple is displayed correctly""" - self.build() lldbutil.run_to_source_breakpoint( self, "// break here", lldb.SBFileSpec("main.cpp", False) ) @@ -43,3 +41,13 @@ def test(self): "}", ], ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/Makefile similarity index 92% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/Makefile index c1c8b4a2a0a53..ece665a0fd5b7 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/Makefile @@ -1,7 +1,5 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 - # We need debug info tuning for lldb in order to emit the preferred name for # std::string. See https://reviews.llvm.org/D145803. CXXFLAGS_EXTRAS := -std=c++14 -glldb diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/TestDataFormatterUniquePtr.py similarity index 93% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/TestDataFormatterUniquePtr.py index 25a1cd82a4baa..8fca83ce80893 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/TestDataFormatterUniquePtr.py @@ -1,5 +1,5 @@ """ -Test lldb data formatter for libc++ std::unique_ptr. +Test lldb data formatter for std::unique_ptr. """ @@ -32,11 +32,8 @@ def make_expected_basic_string_ptr(self) -> str: "std::default_delete<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >" ) - @add_test_categories(["libc++"]) - def test_unique_ptr_variables(self): + def do_test(self): """Test `frame variable` output for `std::unique_ptr` types.""" - self.build() - lldbutil.run_to_source_breakpoint( self, "// break here", lldb.SBFileSpec("main.cpp") ) @@ -121,3 +118,13 @@ def test_unique_ptr_variables(self): self.expect_var_path("ptr_node->next->value", value="2") self.expect_var_path("(*ptr_node).value", value="1") self.expect_var_path("(*(*ptr_node).next).value", value="2") + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile new file mode 100644 index 0000000000000..99998b20bcb05 --- /dev/null +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMapIterator.py similarity index 91% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMapIterator.py index bf103aa78baba..e950bd677a3e0 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMapIterator.py @@ -8,7 +8,7 @@ from lldbsuite.test import lldbutil -class LibcxxUnorderedMapDataFormatterTestCase(TestBase): +class StdUnorderedMapIteratorDataFormatterTestCase(TestBase): def check_ptr_or_ref(self, var_name: str): var = self.frame().FindVariable(var_name) self.assertTrue(var) @@ -32,12 +32,10 @@ def check_ptr_ptr(self, var_name: str): self.assertEqual(pair.GetChildAtIndex(0).summary, '"Hello"') self.assertEqual(pair.GetChildAtIndex(1).summary, '"World"') - @add_test_categories(["libc++"]) - def test_iterator_formatters(self): + def do_test(self): """Test that std::unordered_map related structures are formatted correctly when printed. Currently only tests format of std::unordered_map iterators. """ - self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "Break here", lldb.SBFileSpec("main.cpp", False) ) @@ -113,3 +111,13 @@ def test_iterator_formatters(self): self.check_ptr_ptr("ptr4") self.check_ptr_ptr("ptr5") self.check_ptr_ptr("ptr6") + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/Makefile new file mode 100644 index 0000000000000..99998b20bcb05 --- /dev/null +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/TestDataFormatterStdValarray.py similarity index 94% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/TestDataFormatterStdValarray.py index 613546b50a770..42cbaeba45115 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/TestDataFormatterLibcxxValarray.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/TestDataFormatterStdValarray.py @@ -9,11 +9,9 @@ from lldbsuite.test import lldbutil -class LibcxxChronoDataFormatterTestCase(TestBase): - @add_test_categories(["libc++"]) - def test_with_run_command(self): +class StdValarrayDataFormatterTestCase(TestBase): + def do_test(self): """Test that that file and class static variables display correctly.""" - self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp", False) ) @@ -179,3 +177,13 @@ def test_with_run_command(self): error=True, substrs=['array index 3 is not valid for "(indirect_array<int>) ia"'], ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/valarray/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/Makefile similarity index 82% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/Makefile index 7eeff7407804d..8783ac3ad8a4e 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/Makefile @@ -1,6 +1,4 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 - CXXFLAGS_EXTRAS := -std=c++17 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py similarity index 89% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py index 47e07a5ce3f5b..19d18d6b4ed9b 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py @@ -9,8 +9,7 @@ from lldbsuite.test import lldbutil -class LibcxxVariantDataFormatterTestCase(TestBase): - @add_test_categories(["libc++"]) +class StdVariantDataFormatterTestCase(TestBase): ## Clang 7.0 is the oldest Clang that can reliably parse newer libc++ versions ## with -std=c++17. @skipIf( @@ -20,9 +19,8 @@ class LibcxxVariantDataFormatterTestCase(TestBase): @skipIf(compiler="gcc", compiler_version=["<", "5.1"]) ## std::get is unavailable for std::variant before macOS 10.14 @skipIf(macos_version=["<", "10.14"]) - def test_with_run_command(self): + def do_test(self): """Test that that file and class static variables display correctly.""" - self.build() (self.target, self.process, _, bkpt) = lldbutil.run_to_source_breakpoint( self, "// break here", lldb.SBFileSpec("main.cpp", False) @@ -86,3 +84,13 @@ def test_with_run_command(self): "frame variable v_300_types_no_value", substrs=["v_300_types_no_value = No Value"], ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/Makefile new file mode 100644 index 0000000000000..8046b0bca5533 --- /dev/null +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp +include Makefile.rules + diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/TestDataFormatterVBool.py similarity index 87% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/TestDataFormatterVBool.py index 24dddee62e1e7..cd5478b178b75 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/TestDataFormatterVBool.py @@ -9,17 +9,15 @@ from lldbsuite.test import lldbutil -class LibcxxVBoolDataFormatterTestCase(TestBase): +class StdVBoolDataFormatterTestCase(TestBase): def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break at. self.line = line_number("main.cpp", "// Set break point at this line.") - @add_test_categories(["libc++"]) - def test_with_run_command(self): + def do_test(self): """Test that that file and class static variables display correctly.""" - self.build() self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( @@ -74,3 +72,13 @@ def cleanup(): "[48] = true", ], ) + + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/Makefile new file mode 100644 index 0000000000000..99998b20bcb05 --- /dev/null +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/Makefile @@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterVector.py similarity index 90% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterVector.py index 13341a9b274be..698d583f30f3d 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterVector.py @@ -9,7 +9,7 @@ from lldbsuite.test import lldbutil -class LibcxxVectorDataFormatterTestCase(TestBase): +class StdVectorDataFormatterTestCase(TestBase): def check_numbers(self, var_name, show_ptr=False): patterns = [] substrs = [ @@ -52,10 +52,8 @@ def check_numbers(self, var_name, show_ptr=False): self.expect("frame variable " + var_name + "[2]", substrs=["123"]) self.expect("frame variable " + var_name + "[3]", substrs=["1234"]) - @add_test_categories(["libc++"]) - def test_with_run_command(self): + def do_test(self): """Test that that file and class static variables display correctly.""" - self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp", False) ) @@ -171,9 +169,17 @@ def cleanup(): self.expect("frame variable strings", substrs=["vector has 0 items"]) @add_test_categories(["libc++"]) - def test_ref_and_ptr(self): + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test() + + @add_test_categories(["libstdcxx"]) + def test_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test() + + def do_test_ref_and_ptr(self): """Test that that file and class static variables display correctly.""" - self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "Stop here to check by ref", lldb.SBFileSpec("main.cpp", False) ) @@ -186,3 +192,13 @@ def test_ref_and_ptr(self): self.expect("frame variable ptr", substrs=["ptr =", " size=7"]) self.expect("expression ptr", substrs=["$", "size=7"]) + + @add_test_categories(["libc++"]) + def test_ref_and_ptr_libcxx(self): + self.build(dictionary={"USE_LIBCPP" : 1}) + self.do_test_ref_and_ptr() + + @add_test_categories(["libstdcxx"]) + def test_ref_and_ptr_libstdcxx(self): + self.build(dictionary={"USE_LIBSTDCPP" : 1}) + self.do_test_ref_and_ptr() diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile deleted file mode 100644 index 98af672c70fbe..0000000000000 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -CXX_SOURCES := main.cpp -CXXFLAGS_EXTRAS := -std=c++11 - -USE_LIBCPP := 1 - -include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile deleted file mode 100644 index 564cbada74e08..0000000000000 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 - -CXXFLAGS_EXTRAS := -O0 -include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile deleted file mode 100644 index 564cbada74e08..0000000000000 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 - -CXXFLAGS_EXTRAS := -O0 -include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile deleted file mode 100644 index 564cbada74e08..0000000000000 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -CXX_SOURCES := main.cpp - -USE_LIBCPP := 1 - -CXXFLAGS_EXTRAS := -O0 -include Makefile.rules >From 46db059ab35c2e504555cd9124fc678222d73889 Mon Sep 17 00:00:00 2001 From: Michael Buch <michaelbuc...@gmail.com> Date: Wed, 2 Jul 2025 17:21:03 +0100 Subject: [PATCH 2/3] fixup! delete leftover test --- .../TestDataFormatterLibcxxRangesRefView.py | 79 ------------------- 1 file changed, 79 deletions(-) delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py deleted file mode 100644 index 5603435168247..0000000000000 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py +++ /dev/null @@ -1,79 +0,0 @@ -""" -Test LLDB's std::ranges::ref_view formatter -""" - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class StdRangesRefViewDataFormatterTestCase(TestBase): - def check_string_vec_children(self): - return [ - ValueCheck(name="[0]", summary='"First"'), - ValueCheck(name="[1]", summary='"Second"'), - ValueCheck(name="[2]", summary='"Third"'), - ValueCheck(name="[3]", summary='"Fourth"'), - ] - - def check_string_vec_ref_view(self): - return ValueCheck( - name="*__range_", - summary="size=4", - children=self.check_string_vec_children(), - ) - - def check_foo(self): - return ValueCheck(name="vec", children=self.check_string_vec_children()) - - @skipIf(compiler=no_match("clang")) - @skipIf(compiler="clang", compiler_version=["<", "16.0"]) - def do_test(self): - """Test that std::ranges::ref_view is formatted correctly when printed.""" - (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( - self, "Break here", lldb.SBFileSpec("main.cpp", False) - ) - - # Check ref_view over a std::string - self.expect_var_path( - "single", children=[ValueCheck(name="*__range_", summary='"First"')] - ) - - # Check all_view, which is a ref_view in this case - self.expect_var_path("all", children=[self.check_string_vec_ref_view()]) - - # Check take_view format. Embeds a ref_view - self.expect_var_path( - "subset", - children=[ - ValueCheck(children=[self.check_string_vec_ref_view()]), - ValueCheck(name="__count_", value="2"), - ], - ) - - lldbutil.continue_to_breakpoint(self.process(), bkpt) - - # Check ref_view over custom type 'struct Foo' - self.expect_var_path( - "view", - children=[ - ValueCheck( - name="*__range_", - children=[ - ValueCheck(name="[0]", type="Foo", children=[self.check_foo()]), - ValueCheck(name="[1]", type="Foo", children=[self.check_foo()]), - ], - ) - ], - ) - - @add_test_categories(["libc++"]) - def test_libcxx(self): - self.build(dictionary={"USE_LIBCPP" : 1}) - self.do_test() - - @add_test_categories(["libstdcxx"]) - def test_libstdcpp(self): - self.build(dictionary={"USE_LIBSTDCPP" : 1}) - self.do_test() >From 255b6ea870e010add59d6c922be2d3e359148f19 Mon Sep 17 00:00:00 2001 From: Michael Buch <michaelbuc...@gmail.com> Date: Wed, 2 Jul 2025 17:22:30 +0100 Subject: [PATCH 3/3] fixup! move decorators --- .../atomic/TestDataFormatterStdAtomic.py | 3 ++- .../chrono/TestDataFormatterStdChrono.py | 3 ++- .../queue/TestDataFormatterStdQueue.py | 9 ++++--- .../TestDataFormatterStdRangesRefView.py | 6 +++-- .../variant/TestDataFormatterStdVariant.py | 27 ++++++++++++------- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py index 87e7541dbfe24..04c4831cb2b4b 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py @@ -16,7 +16,6 @@ def get_variable(self, name): var.SetPreferSyntheticValue(True) return var - @skipIf(compiler=["gcc"]) def do_test(self): """Test that std::atomic is correctly printed by LLDB""" self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) @@ -65,11 +64,13 @@ def do_test(self): "frame var p.child.parent", substrs=["p.child.parent = {\n Value = 0x"] ) + @skipIf(compiler=["gcc"]) @add_test_categories(["libc++"]) def test_libcxx(self): self.build(dictionary={"USE_LIBCPP" : 1}) self.do_test() + @skipIf(compiler=["gcc"]) @add_test_categories(["libstdcxx"]) def test_libstdcxx(self): self.build(dictionary={"USE_LIBSTDCPP" : 1}) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py index 626633e322b14..a69fb95729442 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py @@ -10,7 +10,6 @@ class StdChronoDataFormatterTestCase(TestBase): - @skipIf(compiler="clang", compiler_version=["<", "17.0"]) def do_test(self): """Test that that file and class static variables display correctly.""" isNotWindowsHost = lldbplatformutil.getHostPlatform() != "windows" @@ -432,11 +431,13 @@ def do_test(self): ], ) + @skipIf(compiler="clang", compiler_version=["<", "17.0"]) @add_test_categories(["libc++"]) def test_libcxx(self): self.build(dictionary={"USE_LIBCPP" : 1}) self.do_test() + @skipIf(compiler="clang", compiler_version=["<", "17.0"]) @add_test_categories(["libstdcxx"]) def test_libstdcxx(self): self.build(dictionary={"USE_LIBSTDCPP" : 1}) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py index 02898ffa0d881..c48488cdec88b 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py @@ -26,9 +26,6 @@ def check_variable(self, name): self.assertTrue(ch.IsValid()) self.assertEqual(ch.GetValueAsSigned(), i + 1) - @expectedFailureAll( - bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android" - ) def do_test(self): """Test that std::queue is displayed correctly""" lldbutil.run_to_source_breakpoint( @@ -38,11 +35,17 @@ def do_test(self): self.check_variable("q1") self.check_variable("q2") + @expectedFailureAll( + bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android" + ) @add_test_categories(["libc++"]) def test_libcxx(self): self.build(dictionary={"USE_LIBCPP" : 1}) self.do_test() + @expectedFailureAll( + bugnumber="llvm.org/pr36109", debug_info="gmodules", triple=".*-android" + ) @add_test_categories(["libstdcxx"]) def test_libstdcxx(self): self.build(dictionary={"USE_LIBSTDCPP" : 1}) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py index 5603435168247..27047fe56a7ea 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py @@ -27,8 +27,6 @@ def check_string_vec_ref_view(self): def check_foo(self): return ValueCheck(name="vec", children=self.check_string_vec_children()) - @skipIf(compiler=no_match("clang")) - @skipIf(compiler="clang", compiler_version=["<", "16.0"]) def do_test(self): """Test that std::ranges::ref_view is formatted correctly when printed.""" (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( @@ -68,11 +66,15 @@ def do_test(self): ], ) + @skipIf(compiler=no_match("clang")) + @skipIf(compiler="clang", compiler_version=["<", "16.0"]) @add_test_categories(["libc++"]) def test_libcxx(self): self.build(dictionary={"USE_LIBCPP" : 1}) self.do_test() + @skipIf(compiler=no_match("clang")) + @skipIf(compiler="clang", compiler_version=["<", "16.0"]) @add_test_categories(["libstdcxx"]) def test_libstdcpp(self): self.build(dictionary={"USE_LIBSTDCPP" : 1}) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py index 19d18d6b4ed9b..3d7444623993d 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py @@ -10,15 +10,6 @@ class StdVariantDataFormatterTestCase(TestBase): - ## Clang 7.0 is the oldest Clang that can reliably parse newer libc++ versions - ## with -std=c++17. - @skipIf( - oslist=no_match(["macosx"]), compiler="clang", compiler_version=["<", "7.0"] - ) - ## We are skipping gcc version less that 5.1 since this test requires -std=c++17 - @skipIf(compiler="gcc", compiler_version=["<", "5.1"]) - ## std::get is unavailable for std::variant before macOS 10.14 - @skipIf(macos_version=["<", "10.14"]) def do_test(self): """Test that that file and class static variables display correctly.""" @@ -85,11 +76,29 @@ def do_test(self): substrs=["v_300_types_no_value = No Value"], ) + ## Clang 7.0 is the oldest Clang that can reliably parse newer libc++ versions + ## with -std=c++17. + @skipIf( + oslist=no_match(["macosx"]), compiler="clang", compiler_version=["<", "7.0"] + ) + ## We are skipping gcc version less that 5.1 since this test requires -std=c++17 + @skipIf(compiler="gcc", compiler_version=["<", "5.1"]) + ## std::get is unavailable for std::variant before macOS 10.14 + @skipIf(macos_version=["<", "10.14"]) @add_test_categories(["libc++"]) def test_libcxx(self): self.build(dictionary={"USE_LIBCPP" : 1}) self.do_test() + ## Clang 7.0 is the oldest Clang that can reliably parse newer libc++ versions + ## with -std=c++17. + @skipIf( + oslist=no_match(["macosx"]), compiler="clang", compiler_version=["<", "7.0"] + ) + ## We are skipping gcc version less that 5.1 since this test requires -std=c++17 + @skipIf(compiler="gcc", compiler_version=["<", "5.1"]) + ## std::get is unavailable for std::variant before macOS 10.14 + @skipIf(macos_version=["<", "10.14"]) @add_test_categories(["libstdcxx"]) def test_libstdcxx(self): self.build(dictionary={"USE_LIBSTDCPP" : 1}) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits