Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8711013

Browse files
authored
Merge pull request swiftlang#2211 from Teemperor/cherry/199ec40e7bcc8548282d803b1a43b1ae1d3b57ce
[lldb][NFC] Refactor _get_bool_config_skip_if_decorator
2 parents b906ddc + d3b3d7a commit 8711013

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

+12-3
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,20 @@ def skipIfAsan(func):
815815
"""Skip this test if the environment is set up to run LLDB *itself* under ASAN."""
816816
return skipTestIfFn(is_running_under_asan)(func)
817817

818-
def _get_bool_config_skip_if_decorator(key):
818+
def _get_bool_config(key, fail_value = True):
819+
"""
820+
Returns the current LLDB's build config value.
821+
:param key The key to lookup in LLDB's build configuration.
822+
:param fail_value The error value to return when the key can't be found.
823+
Defaults to true so that if an unknown key is lookup up we rather
824+
enable more tests (that then fail) than silently skipping them.
825+
"""
819826
config = lldb.SBDebugger.GetBuildConfiguration()
820827
value_node = config.GetValueForKey(key)
821-
fail_value = True # More likely to notice if something goes wrong
822-
have = value_node.GetValueForKey("value").GetBooleanValue(fail_value)
828+
return value_node.GetValueForKey("value").GetBooleanValue(fail_value)
829+
830+
def _get_bool_config_skip_if_decorator(key):
831+
have = _get_bool_config(key)
823832
return unittest2.skipIf(not have, "requires " + key)
824833

825834
def skipIfCursesSupportMissing(func):

0 commit comments

Comments
 (0)