diff options
author | Igor Kudrin <ikudrin@accesssoftek.com> | 2025-07-30 12:54:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-30 12:54:58 -0700 |
commit | 90aed4dbdfe7354405db980d2b684bf91f69b4fb (patch) | |
tree | 921a69d254b83e6051d8050b30b35f2c92a6b6a9 /lldb/packages/Python/lldbsuite/test/lldbtest.py | |
parent | e4c0f300309fbdcdabc43ff4bf57957181d6451e (diff) | |
download | llvm-90aed4dbdfe7354405db980d2b684bf91f69b4fb.zip llvm-90aed4dbdfe7354405db980d2b684bf91f69b4fb.tar.gz llvm-90aed4dbdfe7354405db980d2b684bf91f69b4fb.tar.bz2 |
[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.
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbtest.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 6eb021d..0fc85fc 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -1778,16 +1778,15 @@ class LLDBTestCaseFactory(type): attrvalue, "__no_debug_info_test__", False ): # If any debug info categories were explicitly tagged, assume that list to be - # authoritative. If none were specified, try with all debug - # info formats. + # authoritative. If none were specified, try with all debug info formats. + test_method_categories = set(getattr(attrvalue, "categories", [])) all_dbginfo_categories = set( test_categories.debug_info_categories.keys() ) - categories = ( - set(getattr(attrvalue, "categories", [])) & all_dbginfo_categories - ) - if not categories: - categories = [ + dbginfo_categories = test_method_categories & all_dbginfo_categories + other_categories = list(test_method_categories - all_dbginfo_categories) + if not dbginfo_categories: + dbginfo_categories = [ category for category, can_replicate in test_categories.debug_info_categories.items() if can_replicate @@ -1799,9 +1798,8 @@ class LLDBTestCaseFactory(type): skip_for_debug_info_cat_fn = getattr( attrvalue, "__skip_for_debug_info_cat_fn__", no_reason ) - for cat in categories: + for cat in dbginfo_categories: - @decorators.add_test_categories([cat]) @wraps(attrvalue) def test_method(self, attrvalue=attrvalue): return attrvalue(self) @@ -1809,6 +1807,7 @@ class LLDBTestCaseFactory(type): method_name = attrname + "_" + cat test_method.__name__ = method_name test_method.debug_info = cat + test_method.categories = other_categories + [cat] xfail_reason = xfail_for_debug_info_cat_fn(cat) if xfail_reason: |