[Lldb-commits] [lldb] [lldb][test] Combine libstdc++ and libc++ vector<bool> tests into generic test (PR #147137)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Sat Jul 5 03:06:06 PDT 2025
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/147137
The libc++ and libstdc++ tests were pretty much an exact copy of each other. This test moves the libc++ test into generic removes it from libstdc++. I moved the `GLIBCXX_DEBUG` case over from libstdcxx. For some reason the libstdcxx test was skipped, but it passes on my Linux machine. So I unskipped it for now.
Split out from https://github.com/llvm/llvm-project/pull/146740
>From 7c3bc48f144a511f5fab330778b201a190622132 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Sat, 5 Jul 2025 10:43:00 +0100
Subject: [PATCH] [lldb][test] Combine libstdc++ and libc++ vector<bool> tests
into generic test
---
.../{libcxx => generic}/vbool/Makefile | 2 +-
.../vbool/TestDataFormatterStdVBool.py | 31 ++++----
.../data-formatter-stl/generic/vbool/main.cpp | 65 ++++++++++++++++
.../vbool/TestDataFormatterLibcxxVBool.py | 76 -------------------
.../data-formatter-stl/libcxx/vbool/main.cpp | 65 ----------------
.../libstdcpp/vbool/Makefile | 6 --
.../libstdcpp/vbool/main.cpp | 63 ---------------
7 files changed, 84 insertions(+), 224 deletions(-)
rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/vbool/Makefile (75%)
rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libstdcpp => generic}/vbool/TestDataFormatterStdVBool.py (80%)
create mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/main.cpp
delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py
delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp
delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/Makefile
delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/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/vbool/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/vbool/Makefile
index d87cf7d402787..65e9dd2fa9e33 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/vbool/Makefile
@@ -1,4 +1,4 @@
CXX_SOURCES := main.cpp
-USE_LIBCPP := 1
+
include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/TestDataFormatterStdVBool.py
similarity index 80%
rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/TestDataFormatterStdVBool.py
index f3371bc014b17..5d2b3f2cabf15 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/TestDataFormatterStdVBool.py
@@ -3,7 +3,6 @@
"""
-from typing import Optional
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -17,19 +16,8 @@ def setUp(self):
# Find the line number to break at.
self.line = line_number("main.cpp", "// Set break point at this line.")
- @skip
- @add_test_categories(["libstdcxx"])
- def test_with_run_command(self):
- self.with_run_command()
-
- @add_test_categories(["libstdcxx"])
- def test_with_run_command_debug(self):
- build_args = {"CXXFLAGS_EXTRAS": "-D_GLIBCXX_DEBUG"}
- self.with_run_command(build_args)
-
- def with_run_command(self, dictionary: Optional[dict] = None):
+ def do_test(self):
"""Test that that file and class static variables display correctly."""
- self.build(dictionary=dictionary)
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
lldbutil.run_break_set_by_file_and_line(
@@ -52,6 +40,7 @@ def cleanup():
self.runCmd("type summary clear", check=False)
self.runCmd("type filter clear", check=False)
self.runCmd("type synth clear", check=False)
+ self.runCmd("settings set target.max-children-count 24", check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@@ -83,3 +72,19 @@ 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()
+
+ @add_test_categories(["libstdcxx"])
+ def test_libstdcxx_debug(self):
+ self.build(dictionary={"USE_LIBSTDCPP" : 1,
+ "CXXFLAGS_EXTRAS": "-D_GLIBCXX_DEBUG"})
+ self.do_test()
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/main.cpp
new file mode 100644
index 0000000000000..22fc6c89ca8a2
--- /dev/null
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/main.cpp
@@ -0,0 +1,65 @@
+#include <cstdio>
+#include <string>
+#include <vector>
+
+int main() {
+ std::vector<bool> vBool;
+
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(false);
+ vBool.push_back(true);
+ vBool.push_back(true);
+
+ std::puts("// Set break point at this line.");
+ return 0;
+}
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/libcxx/vbool/TestDataFormatterLibcxxVBool.py
deleted file mode 100644
index 24dddee62e1e7..0000000000000
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py
+++ /dev/null
@@ -1,76 +0,0 @@
-"""
-Test lldb data formatter subsystem.
-"""
-
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class LibcxxVBoolDataFormatterTestCase(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):
- """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(
- self, "main.cpp", self.line, num_expected_locations=-1
- )
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- # The stop reason of the thread should be breakpoint.
- self.expect(
- "thread list",
- STOPPED_DUE_TO_BREAKPOINT,
- substrs=["stopped", "stop reason = breakpoint"],
- )
-
- # This is the function to remove the custom formats in order to have a
- # clean slate for the next test case.
- def cleanup():
- self.runCmd("type format clear", check=False)
- self.runCmd("type summary clear", check=False)
- self.runCmd("type filter clear", check=False)
- self.runCmd("type synth clear", check=False)
- self.runCmd("settings set target.max-children-count 24", check=False)
-
- # Execute the cleanup function during test case tear down.
- self.addTearDownHook(cleanup)
-
- self.expect(
- "frame variable -A vBool",
- substrs=[
- "size=49",
- "[0] = false",
- "[1] = true",
- "[18] = false",
- "[27] = true",
- "[36] = false",
- "[47] = true",
- "[48] = true",
- ],
- )
-
- self.expect(
- "expr -A -- vBool",
- substrs=[
- "size=49",
- "[0] = false",
- "[1] = true",
- "[18] = false",
- "[27] = true",
- "[36] = false",
- "[47] = true",
- "[48] = true",
- ],
- )
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/libcxx/vbool/main.cpp
deleted file mode 100644
index 026cfc863f2c0..0000000000000
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <string>
-#include <vector>
-
-int main()
-{
- std::vector<bool> vBool;
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(true);
-
- printf ("size: %d", (int) vBool.size()); // Set break point at this line.
- return 0;
-}
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/Makefile
deleted file mode 100644
index c825977b1a5dc..0000000000000
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CFLAGS_EXTRAS := -O0
-USE_LIBSTDCPP := 1
-
-include Makefile.rules
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/main.cpp
deleted file mode 100644
index 73956dd3fda31..0000000000000
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <vector>
-
-int main()
-{
- std::vector<bool> vBool;
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
-
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(false);
- vBool.push_back(true);
- vBool.push_back(true);
-
- return 0; // Set break point at this line.
-}
More information about the lldb-commits
mailing list