chying updated this revision to Diff 40347.
chying added a comment.

Recommit r253106 - Add a "not_in()" function you can apply to the list type 
arguments to expectedFailureAll ... 
Initialize self.debug_info in Base::setUp()
Check for None before calling "value in list"


http://reviews.llvm.org/D14673

Files:
  
packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
  packages/Python/lldbsuite/test/lldbtest.py

Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -620,13 +620,30 @@
 # @expectedFailureAll, xfail for all platform/compiler/arch,
 # @expectedFailureAll(compiler='gcc'), xfail for gcc on all 
platform/architecture
 # @expectedFailureAll(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), 
xfail for gcc>=4.9 on linux with i386
+
+# 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
+
 def expectedFailureAll(bugnumber=None, oslist=None, compiler=None, 
compiler_version=None, archs=None, triple=None, debug_info=None):
     def fn(self):
-        return ((oslist is None or self.getPlatform() in oslist) and
-                (compiler is None or (compiler in self.getCompiler() and 
self.expectedCompilerVersion(compiler_version))) and
+        os_list_passes = check_list_or_lambda(oslist, self.getPlatform())
+        compiler_passes = check_list_or_lambda(self.getCompiler(), compiler) 
and self.expectedCompilerVersion(compiler_version)
+        debug_info_passes = check_list_or_lambda(debug_info, self.debug_info)
+
+        return (os_list_passes  and
+                compiler_passes and
                 self.expectedArch(archs) and
                 (triple is None or re.match(triple, 
lldb.DBG.GetSelectedPlatform().GetTriple())) and
-                (debug_info is None or self.debug_info in debug_info))
+                debug_info_passes)
     return expectedFailure(fn, bugnumber)
 
 def expectedFailureDwarf(bugnumber=None):
@@ -1459,6 +1476,9 @@
 
         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.
 
Index: 
packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
===================================================================
--- 
packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
+++ 
packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
@@ -15,7 +15,7 @@
 
     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()


Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -620,13 +620,30 @@
 # @expectedFailureAll, xfail for all platform/compiler/arch,
 # @expectedFailureAll(compiler='gcc'), xfail for gcc on all platform/architecture
 # @expectedFailureAll(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), xfail for gcc>=4.9 on linux with i386
+
+# 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
+
 def expectedFailureAll(bugnumber=None, oslist=None, compiler=None, compiler_version=None, archs=None, triple=None, debug_info=None):
     def fn(self):
-        return ((oslist is None or self.getPlatform() in oslist) and
-                (compiler is None or (compiler in self.getCompiler() and self.expectedCompilerVersion(compiler_version))) and
+        os_list_passes = check_list_or_lambda(oslist, self.getPlatform())
+        compiler_passes = check_list_or_lambda(self.getCompiler(), compiler) and self.expectedCompilerVersion(compiler_version)
+        debug_info_passes = check_list_or_lambda(debug_info, self.debug_info)
+
+        return (os_list_passes  and
+                compiler_passes and
                 self.expectedArch(archs) and
                 (triple is None or re.match(triple, lldb.DBG.GetSelectedPlatform().GetTriple())) and
-                (debug_info is None or self.debug_info in debug_info))
+                debug_info_passes)
     return expectedFailure(fn, bugnumber)
 
 def expectedFailureDwarf(bugnumber=None):
@@ -1459,6 +1476,9 @@
 
         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.
 
Index: packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
+++ packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoins/TestConsecutiveBreakpoints.py
@@ -15,7 +15,7 @@
 
     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()
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to