From 4f261887775013b0ecc81abbb760eeee188a58db Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 9 Jul 2025 11:46:31 +0100 Subject: [PATCH 1/2] [lldb][test] Move std::span from libcxx to generic directory --- .../{libcxx => generic}/span/Makefile | 3 --- .../span/TestDataFormatterStdSpan.py} | 21 ++++++++++++------- .../{libcxx => generic}/span/main.cpp | 0 3 files changed, 14 insertions(+), 10 deletions(-) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/span/Makefile (81%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/span/TestDataFormatterLibcxxSpan.py => generic/span/TestDataFormatterStdSpan.py} (94%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/span/main.cpp (100%) 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/span/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/span/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/span/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/span/TestDataFormatterLibcxxSpan.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py similarity index 94% 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..215d8444ae2c7 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) ) @@ -158,9 +155,13 @@ def test_with_run_command(self): ) self.check_size("nested", 2) - @add_test_categories(["libc++"]) @skipIf(compiler="clang", compiler_version=["<", "11.0"]) - def test_ref_and_ptr(self): + @add_test_categories(["libc++"]) + def test_libcxx(self): + self.build(dictionary={"USE_LIBCPP": 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( @@ -173,3 +174,9 @@ 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"]) + + @skipIf(compiler="clang", compiler_version=["<", "11.0"]) + @add_test_categories(["libc++"]) + def test_ref_and_ptr_libcxx(self): + self.build(dictionary={"USE_LIBCPP": 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 From 4f8d5eb5d53b72162ba96f69c79f5b8c1fbccba7 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 9 Jul 2025 11:49:45 +0100 Subject: [PATCH 2/2] fixup! remove redundant self.bulid() --- .../data-formatter-stl/generic/span/TestDataFormatterStdSpan.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py index 215d8444ae2c7..a45c0ff551323 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py @@ -163,7 +163,6 @@ def test_libcxx(self): 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) )