[Lldb-commits] [lldb] r253272 - Re-Apply "Add a "not_in()" function you can apply to the list type arguments to expectedFailureAll ..." with fix

Ying Chen via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 16 15:41:02 PST 2015


Author: chying
Date: Mon Nov 16 17:41:02 2015
New Revision: 253272

URL: http://llvm.org/viewvc/llvm-project?rev=253272&view=rev
Log:
Re-Apply "Add a "not_in()" function you can apply to the list type arguments to expectedFailureAll ..." with fix

Summary:
- Re-Commit r253106
- Initialize self.debug_info in Base::setUp()
- Fix argument order when calling check_list_or_lambda for compiler

Reviewers: jingham

Subscribers: lldb-commits

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

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py?rev=253272&r1=253271&r2=253272&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py Mon Nov 16 17:41:02 2015
@@ -15,7 +15,7 @@ class ConsecutiveBreakpoitsTestCase(Test
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @unittest2.expectedFailure("llvm.org/pr23478")
+    @expectedFailureAll("llvm.org/pr23478", oslist = not_in(["macosx"]))
     def test (self):
         self.build ()
         self.consecutive_breakpoints_tests()

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=253272&r1=253271&r2=253272&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Nov 16 17:41:02 2015
@@ -638,6 +638,18 @@ def expectedFailure(expected_fn, bugnumb
     else:
         return expectedFailure_impl
 
+# 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):
+    return lambda x : x not in iterable
+
+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
 # for example,
@@ -646,11 +658,11 @@ def expectedFailure(expected_fn, bugnumb
 # @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 = 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)
         triple_passes = triple is None or re.match(triple, lldb.DBG.GetSelectedPlatform().GetTriple())
-        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)
 
@@ -1502,6 +1514,9 @@ class Base(unittest2.TestCase):
 
         self.enableLogChannelsForCurrentTest()
 
+        #Initialize debug_info
+        self.debug_info = None
+
     def runHooks(self, child=None, child_prompt=None, use_cmd_api=False):
         """Perform the run hooks to bring lldb debugger to the desired state.
 




More information about the lldb-commits mailing list