Skip to content

Commit 90aed4d

Browse files
authored
[lldb][test] Fix running TestWithLimitDebugInfo.py on Windows (#150579)
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 e4c0f30 commit 90aed4d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,16 +1778,15 @@ def no_reason(_):
17781778
attrvalue, "__no_debug_info_test__", False
17791779
):
17801780
# If any debug info categories were explicitly tagged, assume that list to be
1781-
# authoritative. If none were specified, try with all debug
1782-
# info formats.
1781+
# authoritative. If none were specified, try with all debug info formats.
1782+
test_method_categories = set(getattr(attrvalue, "categories", []))
17831783
all_dbginfo_categories = set(
17841784
test_categories.debug_info_categories.keys()
17851785
)
1786-
categories = (
1787-
set(getattr(attrvalue, "categories", [])) & all_dbginfo_categories
1788-
)
1789-
if not categories:
1790-
categories = [
1786+
dbginfo_categories = test_method_categories & all_dbginfo_categories
1787+
other_categories = list(test_method_categories - all_dbginfo_categories)
1788+
if not dbginfo_categories:
1789+
dbginfo_categories = [
17911790
category
17921791
for category, can_replicate in test_categories.debug_info_categories.items()
17931792
if can_replicate
@@ -1799,16 +1798,16 @@ def no_reason(_):
17991798
skip_for_debug_info_cat_fn = getattr(
18001799
attrvalue, "__skip_for_debug_info_cat_fn__", no_reason
18011800
)
1802-
for cat in categories:
1801+
for cat in dbginfo_categories:
18031802

1804-
@decorators.add_test_categories([cat])
18051803
@wraps(attrvalue)
18061804
def test_method(self, attrvalue=attrvalue):
18071805
return attrvalue(self)
18081806

18091807
method_name = attrname + "_" + cat
18101808
test_method.__name__ = method_name
18111809
test_method.debug_info = cat
1810+
test_method.categories = other_categories + [cat]
18121811

18131812
xfail_reason = xfail_for_debug_info_cat_fn(cat)
18141813
if xfail_reason:

0 commit comments

Comments
 (0)