Skip to content

Commit 386224a

Browse files
committed
[lldb][swift] Make swiftTest decorator not always skip
_get_bool_config_skip_if_decorator returns a decorator, but the is_not_swift_compatible function is supposed to return a bool. The skipTestIfFn is supposed to create the decorator from the function we define. As _get_bool_config_skip_if_decorator's return value is just interpreted as True, this ends up causing that we skip all Swift tests all the time. This just adds a _get_bool_config() function that actually returns a bool. We could probably also solve this by doing a function composition of the returned decorator and the decorator we create from our local function, but just having a bool seems less likely to break.
1 parent b6c965e commit 386224a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,8 @@ def skipUnlessTargetAndroid(func):
626626
def swiftTest(func):
627627
"""Decorate the item as a Swift test (Darwin/Linux only, no i386)."""
628628
def is_not_swift_compatible(self):
629-
swift_enabled_error = _get_bool_config_skip_if_decorator("swift")(func)
630-
if swift_enabled_error:
631-
return swift_enabled_error
629+
if not _get_bool_config("swift"):
630+
return "Swift plugin not enabled"
632631
if self.getDebugInfo() == "gmodules":
633632
return "skipping (gmodules only makes sense for clang tests)"
634633

@@ -886,11 +885,14 @@ def skipIfAsan(func):
886885
"""Skip this test if the environment is set up to run LLDB *itself* under ASAN."""
887886
return skipTestIfFn(is_running_under_asan)(func)
888887

889-
def _get_bool_config_skip_if_decorator(key):
888+
def _get_bool_config(key):
890889
config = lldb.SBDebugger.GetBuildConfiguration()
891890
value_node = config.GetValueForKey(key)
892891
fail_value = True # More likely to notice if something goes wrong
893-
have = value_node.GetValueForKey("value").GetBooleanValue(fail_value)
892+
return value_node.GetValueForKey("value").GetBooleanValue(fail_value)
893+
894+
def _get_bool_config_skip_if_decorator(key):
895+
have = _get_bool_config(key)
894896
return unittest2.skipIf(not have, "requires " + key)
895897

896898
def skipIfCursesSupportMissing(func):

0 commit comments

Comments
 (0)