[Lldb-commits] [lldb] r255542 - Make skipIf decorator support not_in() functor.

Siva Chandra via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 14 16:10:01 PST 2015


This change looks very innocent, but:

On Mon, Dec 14, 2015 at 1:26 PM, Zachary Turner via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255542&r1=255541&r2=255542&view=diff
> ==============================================================================
> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec 14 15:26:49 2015
> @@ -613,14 +613,16 @@ def expectedFailure(expected_fn, bugnumb
>  # You can also pass not_in(list) to reverse the sense of the test for the arguments that
>  # are simple lists, namely oslist, compiler, and debug_info.
>
> -def not_in (iterable):
> +def not_in(iterable):
>      return lambda x : x not in iterable
>
> -def check_list_or_lambda (list_or_lambda, value):
> +def check_list_or_lambda(list_or_lambda, value):
>      if six.callable(list_or_lambda):
>          return list_or_lambda(value)
> -    else:
> +    elif isinstance(list_or_lambda, list):

Previously, list_or_lambda could be a string. It cannot be now. That
is, we should have:

elif isinstance(list_or_lambda, list) or isinstance(list_or_lambda, str):

>          return list_or_lambda is None or value is None or value in list_or_lambda
> +    else:
> +        return list_or_lambda == value

Previously, if value or list_or_lambda were None, this function
returned True. It returns False now unless both are None. That is, it
should be:

else:
    return list_or_lambda is None or value is None or list_or_lambda == value

Will send a change list soon with the above fixed.

>
>  # provide a function to xfail on defined oslist, compiler version, and archs
>  # if none is specified for any argument, that argument won't be checked and thus means for all
> @@ -1090,10 +1092,10 @@ def skipIfLinuxClang(func):
>  # TODO: refactor current code, to make skipIfxxx functions to call this function
>  def skipIf(bugnumber=None, oslist=None, compiler=None, compiler_version=None, archs=None, debug_info=None, swig_version=None, py_version=None, remote=None):
>      def fn(self):
> -        oslist_passes = oslist is None or self.getPlatform() in oslist
> -        compiler_passes = compiler is None or (compiler in self.getCompiler() and self.expectedCompilerVersion(compiler_version))
> +        oslist_passes = check_list_or_lambda(oslist, self.getPlatform())
> +        compiler_passes = check_list_or_lambda(self.getCompiler(), compiler) and self.expectedCompilerVersion(compiler_version)
>          arch_passes = self.expectedArch(archs)
> -        debug_info_passes = debug_info is None or self.debug_info in debug_info
> +        debug_info_passes = check_list_or_lambda(debug_info, self.debug_info)
>          swig_version_passes = (swig_version is None) or (not hasattr(lldb, 'swig_version')) or (check_expected_version(swig_version[0], swig_version[1], lldb.swig_version))
>          py_version_passes = (py_version is None) or check_expected_version(py_version[0], py_version[1], sys.version_info)
>          remote_passes = (remote is None) or (remote == (lldb.remote_platform is not None))


More information about the lldb-commits mailing list