Skip to content

Commit 0c92925

Browse files
committed
[LLDB] Run API tests with native PDB too
1 parent a13712e commit 0c92925

File tree

6 files changed

+37
-1
lines changed

6 files changed

+37
-1
lines changed

lldb/packages/Python/lldbsuite/test/builders/builder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def _getDebugInfoArgs(self, debug_info):
255255
"gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"},
256256
"debug_names": {"MAKE_DEBUG_NAMES": "YES"},
257257
"dwp": {"MAKE_DSYM": "NO", "MAKE_DWP": "YES"},
258+
"pdb": {"DEBUG_INFO_FLAG": "-g"},
258259
}
259260

260261
# Collect all flags, with later options overriding earlier ones

lldb/packages/Python/lldbsuite/test/decorators.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,10 @@ def expectedFailureWindows(bugnumber=None):
573573
return expectedFailureOS(["windows"], bugnumber)
574574

575575

576+
def expectedFailurePDB(bugnumber=None):
577+
return expectedFailureAll(debug_info="pdb", bugnumber=bugnumber)
578+
579+
576580
# TODO: This decorator does not do anything. Remove it.
577581
def expectedFlakey(expected_fn, bugnumber=None):
578582
def expectedFailure_impl(func):

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,6 +1790,11 @@ def no_reason(_):
17901790
if can_replicate
17911791
]
17921792

1793+
# PDB is off by default, because it has a lot of failures right now.
1794+
# See llvm.org/pr149498
1795+
if original_testcase.TEST_WITH_PDB_DEBUG_INFO:
1796+
categories.append("pdb")
1797+
17931798
xfail_for_debug_info_cat_fn = getattr(
17941799
attrvalue, "__xfail_for_debug_info_cat_fn__", no_reason
17951800
)
@@ -1877,6 +1882,14 @@ class TestBase(Base, metaclass=LLDBTestCaseFactory):
18771882
# test multiple times with various debug info types.
18781883
NO_DEBUG_INFO_TESTCASE = False
18791884

1885+
TEST_WITH_PDB_DEBUG_INFO = False
1886+
"""
1887+
Subclasses can set this to True to test with PDB (native) in addition to
1888+
the other debug info types. This id off by default because many tests will
1889+
fail due to missing functionality in PDB.
1890+
See llvm.org/pr149498.
1891+
"""
1892+
18801893
def generateSource(self, source):
18811894
template = source + ".template"
18821895
temp = os.path.join(self.getSourceDir(), template)

lldb/packages/Python/lldbsuite/test/test_categories.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
# System modules
66
import sys
7+
import os
78

89
# Third-party modules
910

@@ -12,7 +13,13 @@
1213

1314
# Key: Category name
1415
# Value: should be used in lldbtest's debug-info replication
15-
debug_info_categories = {"dwarf": True, "dwo": True, "dsym": True, "gmodules": False}
16+
debug_info_categories = {
17+
"dwarf": True,
18+
"dwo": True,
19+
"dsym": True,
20+
"pdb": False,
21+
"gmodules": False,
22+
}
1623

1724
all_categories = {
1825
"basic_process": "Basic process execution sniff tests.",
@@ -34,6 +41,7 @@
3441
"lldb-dap": "Tests for the Debug Adapter Protocol with lldb-dap",
3542
"llgs": "Tests for the gdb-server functionality of lldb-server",
3643
"msvcstl": "Test for MSVC STL data formatters",
44+
"pdb": "Tests that can be run with PDB debug information",
3745
"pexpect": "Tests requiring the pexpect library to be available",
3846
"objc": "Tests related to the Objective-C programming language support",
3947
"pyapi": "Tests related to the Python API",
@@ -65,6 +73,13 @@ def is_supported_on_platform(category, platform, compiler_path):
6573
if platform not in ["darwin", "macosx", "ios", "watchos", "tvos", "bridgeos"]:
6674
return False
6775
return gmodules.is_compiler_clang_with_gmodules(compiler_path)
76+
elif category == "pdb":
77+
if platform == "windows":
78+
assert (
79+
os.environ.get("LLDB_USE_NATIVE_PDB_READER") == "1"
80+
), "Only the native PDB reader is supported"
81+
return True
82+
return False
6883
return True
6984

7085

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterStdVector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def test_libcxx(self):
185185
self.do_test()
186186

187187
@add_test_categories(["msvcstl"])
188+
@expectedFailurePDB # custom summary for std::int_vect doesn't work because typedef aren't preserved
188189
def test_msvcstl(self):
189190
# No flags, because the "msvcstl" category checks that the MSVC STL is used by default.
190191
self.build()

lldb/test/API/lit.cfg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ def delete_module_cache(path):
349349
for v in ["SystemDrive"]:
350350
if v in os.environ:
351351
config.environment[v] = os.environ[v]
352+
# Always use the native PDB reader
353+
config.environment["LLDB_USE_NATIVE_PDB_READER"] = "1"
352354

353355
# Some steps required to initialize the tests dynamically link with python.dll
354356
# and need to know the location of the Python libraries. This ensures that we

0 commit comments

Comments
 (0)