Skip to content

Commit f687e98

Browse files
committed
[lldb][test] Fix running TestWithLimitDebugInfo.py on Windows
When debug info categories were set for a test method with the `@add_test_categories` decorator, they were all added to its "categories" attribute. If some of these categories were not supported, `LLDBTestResult.startTest()` skipped all variants of the test method. For example, the tests in `TestWithLimitDebugInfo.py` use the categories `dwarf` and `dwo`. However, since `dwo` is not supported on Windows, all the tests in this file were skipped, even though the tests for `dwarf` could be run.
1 parent 918d6db commit f687e98

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,16 +1775,20 @@ def no_reason(_):
17751775
attrvalue, "__no_debug_info_test__", False
17761776
):
17771777
# If any debug info categories were explicitly tagged, assume that list to be
1778-
# authoritative. If none were specified, try with all debug
1779-
# info formats.
1780-
all_dbginfo_categories = set(
1778+
# authoritative. If none were specified, try with all debug info formats.
1779+
test_method_categories = getattr(attrvalue, "categories", [])
1780+
dbginfo_categories = set(test_method_categories) & set(
17811781
test_categories.debug_info_categories.keys()
17821782
)
1783-
categories = (
1784-
set(getattr(attrvalue, "categories", [])) & all_dbginfo_categories
1785-
)
1786-
if not categories:
1787-
categories = [
1783+
if dbginfo_categories:
1784+
other_categories = [
1785+
category
1786+
for category in test_method_categories
1787+
if category not in dbginfo_categories
1788+
]
1789+
else:
1790+
other_categories = test_method_categories
1791+
dbginfo_categories = [
17881792
category
17891793
for category, can_replicate in test_categories.debug_info_categories.items()
17901794
if can_replicate
@@ -1796,16 +1800,16 @@ def no_reason(_):
17961800
skip_for_debug_info_cat_fn = getattr(
17971801
attrvalue, "__skip_for_debug_info_cat_fn__", no_reason
17981802
)
1799-
for cat in categories:
1803+
for cat in dbginfo_categories:
18001804

1801-
@decorators.add_test_categories([cat])
18021805
@wraps(attrvalue)
18031806
def test_method(self, attrvalue=attrvalue):
18041807
return attrvalue(self)
18051808

18061809
method_name = attrname + "_" + cat
18071810
test_method.__name__ = method_name
18081811
test_method.debug_info = cat
1812+
test_method.categories = other_categories + [cat]
18091813

18101814
xfail_reason = xfail_for_debug_info_cat_fn(cat)
18111815
if xfail_reason:

0 commit comments

Comments
 (0)