[Lldb-commits] [lldb] r253704 - Revert "Make skipIf support the not_in function (second attempt)."

Siva Chandra via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 20 12:30:36 PST 2015


Author: sivachandra
Date: Fri Nov 20 14:30:36 2015
New Revision: 253704

URL: http://llvm.org/viewvc/llvm-project?rev=253704&view=rev
Log:
Revert "Make skipIf support the not_in function (second attempt)."

Summary: This reverts commit 70dca28976ee8137acce2cc203dd394f4d761276.

Reviewers: amccarth, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D14881

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=253704&r1=253703&r2=253704&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Nov 20 14:30:36 2015
@@ -648,15 +648,11 @@ def expectedFailure(expected_fn, bugnumb
 def not_in (iterable):
     return lambda x : x not in iterable
 
-def check_decorator_attribute(attr, value):
-    if attr is None:
-        return True
-    if six.callable(attr):
-        return attr(value)
-    elif isinstance(attr, (list, tuple)):
-        return value in attr
-    else:
-        return value == attr
+def check_list_or_lambda (list_or_lambda, value):
+    if six.callable(list_or_lambda):
+        return list_or_lambda(value)
+    else:
+        return list_or_lambda is None or value is None or value in list_or_lambda
 
 # 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
@@ -666,11 +662,11 @@ def check_decorator_attribute(attr, valu
 # @expectedFailureAll(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), xfail for gcc>=4.9 on linux with i386
 def expectedFailureAll(bugnumber=None, oslist=None, compiler=None, compiler_version=None, archs=None, triple=None, debug_info=None, swig_version=None, py_version=None):
     def fn(self):
-        oslist_passes = check_decorator_attribute(oslist, self.getPlatform())
-        compiler_passes = check_decorator_attribute(self.getCompiler(), compiler) 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)
         triple_passes = triple is None or re.match(triple, lldb.DBG.GetSelectedPlatform().GetTriple())
-        debug_info_passes = check_decorator_attribute(debug_info, self.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)
 
@@ -1104,10 +1100,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):
     def fn(self):
-        oslist_passes = check_decorator_attribute(oslist, self.getPlatform())
-        compiler_passes = check_decorator_attribute(compiler, self.getCompiler()) and self.expectedCompilerVersion(compiler_version)
+        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))
         arch_passes = self.expectedArch(archs)
-        debug_info_passes = check_decorator_attribute(debug_info, self.debug_info)
+        debug_info_passes = debug_info is None or self.debug_info in 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)
 




More information about the lldb-commits mailing list