Skip to content

[lldb][test] Move std::span from libcxx to generic directory #147680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025

Conversation

Michael137
Copy link
Member

This just moves the test from libcxx to generic. There are currently no std::span formatters for libstdc++ so I didn't add a test-case for it.

Split out from #146740

@Michael137 Michael137 requested a review from labath July 9, 2025 09:58
@Michael137 Michael137 requested a review from JDevlieghere as a code owner July 9, 2025 09:58
@llvmbot llvmbot added the lldb label Jul 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

This just moves the test from libcxx to generic. There are currently no std::span formatters for libstdc++ so I didn't add a test-case for it.

Split out from #146740


Full diff: https://github.com/llvm/llvm-project/pull/147680.diff

3 Files Affected:

  • (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/Makefile (-3)
  • (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py (+14-7)
  • (renamed) 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/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

@Michael137 Michael137 merged commit b0cc186 into llvm:main Jul 9, 2025
9 checks passed
@Michael137 Michael137 deleted the lldb/consolidate-stl-tests-span branch July 9, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants