Hi sivachandra, ovyalov, vharron, chaoren,

- add decorator functions to skip test on specific os, architecture and version 
of comipler
- skip failing test with gcc-4.9.2 on linux

http://reviews.llvm.org/D8851

Files:
  test/api/multithreaded/TestMultithreaded.py
  test/expression_command/test/TestExprs.py
  
test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
  test/functionalities/inferior-crashing/TestInferiorCrashing.py
  test/functionalities/inline-stepping/TestInlineStepping.py
  test/functionalities/memory/read/TestMemoryRead.py
  test/lldbtest.py
  test/tools/lldb-mi/control/TestMiExec.py

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: test/api/multithreaded/TestMultithreaded.py
===================================================================
--- test/api/multithreaded/TestMultithreaded.py
+++ test/api/multithreaded/TestMultithreaded.py
@@ -33,6 +33,7 @@
     @skipIfRemote
     @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
     @skipIfNoSBHeaders
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["x86_64"])
     def test_sb_api_listener_event_description(self):
         """ Test the description of an SBListener breakpoint event is valid."""
         self.build_and_test('driver.cpp listener_test.cpp test_listener_event_description.cpp',
@@ -43,6 +44,7 @@
     @skipIfRemote
     @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
     @skipIfNoSBHeaders
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["x86_64"])
     def test_sb_api_listener_event_process_state(self):
         """ Test that a registered SBListener receives events when a process
             changes state.
@@ -56,6 +58,7 @@
     @skipIfRemote
     @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11
     @skipIfNoSBHeaders
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["x86_64"])
     def test_sb_api_listener_resume(self):
         """ Test that a process can be resumed from a non-main thread. """
         self.build_and_test('driver.cpp listener_test.cpp test_listener_resume.cpp',
Index: test/expression_command/test/TestExprs.py
===================================================================
--- test/expression_command/test/TestExprs.py
+++ test/expression_command/test/TestExprs.py
@@ -51,6 +51,7 @@
             patterns = ["\(float\) \$.* = 2\.234"])
         # (float) $2 = 2.234
 
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_many_expr_commands(self):
         self.build_and_run()
 
@@ -92,6 +93,7 @@
         # (const char *) $8 = 0x... "/Volumes/data/lldb/svn/trunk/test/expression_command/test/a.out"
 
     @python_api_test
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_evaluate_expression_python(self):
         """Test SBFrame.EvaluateExpression() API for evaluating an expression."""
         self.buildDefault()
Index: test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
===================================================================
--- test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
+++ test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
@@ -20,6 +20,7 @@
         self.data_formatter_commands()
 
     @dwarf_test
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["x86_64","i386"])
     def test_with_dwarf_and_run_command(self):
         """Test data formatter commands."""
         self.buildDwarf()
Index: test/functionalities/inferior-crashing/TestInferiorCrashing.py
===================================================================
--- test/functionalities/inferior-crashing/TestInferiorCrashing.py
+++ test/functionalities/inferior-crashing/TestInferiorCrashing.py
@@ -54,6 +54,7 @@
         self.buildDsym()
         self.inferior_crashing_step()
 
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_inferior_crashing_step_dwarf(self):
         """Test that stepping after a crash behaves correctly."""
         self.buildDwarf()
@@ -78,6 +79,7 @@
         self.inferior_crashing_expr_step_expr()
 
     @expectedFailureFreeBSD('llvm.org/pr15989') # Couldn't allocate space for the stack frame
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs="i386")
     def test_inferior_crashing_expr_step_and_expr_dwarf(self):
         """Test that lldb expressions work before and after stepping after a crash."""
         self.buildDwarf()
Index: test/functionalities/inline-stepping/TestInlineStepping.py
===================================================================
--- test/functionalities/inline-stepping/TestInlineStepping.py
+++ test/functionalities/inline-stepping/TestInlineStepping.py
@@ -22,6 +22,7 @@
     @dwarf_test
     @expectedFailureFreeBSD('llvm.org/pr17214')
     @expectedFailureIcc # Not really a bug.  ICC combines two inlined functions.
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_with_dwarf_and_python_api(self):
         """Test stepping over and into inlined functions."""
         self.buildDwarf()
@@ -37,6 +38,7 @@
 
     @python_api_test
     @dwarf_test
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_step_over_with_dwarf_and_python_api(self):
         """Test stepping over and into inlined functions."""
         self.buildDwarf()
Index: test/functionalities/memory/read/TestMemoryRead.py
===================================================================
--- test/functionalities/memory/read/TestMemoryRead.py
+++ test/functionalities/memory/read/TestMemoryRead.py
@@ -21,6 +21,7 @@
         self.memory_read_command()
 
     @dwarf_test
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs="i386")
     def test_memory_read_with_dwarf(self):
         """Test the 'memory read' command with plain and vector formats."""
         self.buildDwarf()
Index: test/lldbtest.py
===================================================================
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -729,6 +729,38 @@
             func(*args, **kwargs)
     return wrapper
 
+# to skip test on specific gcc versions and architecture on Linux
+# example: @skipIfLinuxGcc('bugnumber', ['>=', '4.9'], ['i386'])
+def skipIfLinuxGcc(bugnumber=None, compiler_version=None, archs=None):
+    """Decorate the item to skip tests that should be skipped if building on
+       Linux with Gcc with specific version and arch.
+    """
+    return skipIfPlatformCompiler(bugnumber, "linux", "gcc", compiler_version, archs)
+
+def skipIfPlatformCompiler(bugnumber=None, platform=None, compiler=None, compiler_version=None, archs=None):
+    def fn(self):
+        return (platform in sys.platform and
+                compiler in self.getCompiler() and
+                self.expectedCompilerVersion(compiler_version) and
+                self.expectedArch(archs))
+    return skipTestIfFn(fn, bugnumber, skipReason="skipping because %s with %s %s on arch %s"%(platform, compiler, compiler_version, archs))
+
+def skipTestIfFn(expected_fn, bugnumber=None, skipReason=None):
+    def skipTestIfFn_impl(func):
+        @wraps(func)
+        def wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            if expected_fn(self):
+               self.skipTest(skipReason)
+            else:
+                func(*args, **kwargs)
+        return wrapper
+    if callable(bugnumber):
+        return skipTestIfFn_impl(bugnumber)
+    else:
+        return skipTestIfFn_impl
+
 def skipIfGcc(func):
     """Decorate the item to skip tests that should be skipped if building with gcc ."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -1450,6 +1482,17 @@
 
         return False
 
+    def expectedArch(self, archs):
+        """Returns True iff any element of archs is a sub-string of the current architecture."""
+        if (archs == None):
+            return True
+
+        for arch in archs:
+            if arch in self.getArchitecture():
+                return True
+
+        return False
+
     def getRunOptions(self):
         """Command line option for -A and -C to run this test again, called from
         self.dumpSessionInfo()."""
Index: test/tools/lldb-mi/control/TestMiExec.py
===================================================================
--- test/tools/lldb-mi/control/TestMiExec.py
+++ test/tools/lldb-mi/control/TestMiExec.py
@@ -13,6 +13,7 @@
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_lldbmi_exec_abort(self):
         """Test that 'lldb-mi --interpreter' works for -exec-abort."""
 
@@ -63,6 +64,7 @@
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_lldbmi_exec_arguments_set(self):
         """Test that 'lldb-mi --interpreter' can pass args using -exec-arguments."""
 
@@ -106,6 +108,7 @@
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_lldbmi_exec_arguments_reset(self):
         """Test that 'lldb-mi --interpreter' can reset previously set args using -exec-arguments."""
 
@@ -188,6 +191,7 @@
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
     @expectedFailurei386 #xfail to get buildbot green, failing config: i386 binary running on ubuntu 14.04 x86_64
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs=["i386"])
     def test_lldbmi_exec_next_instruction(self):
         """Test that 'lldb-mi --interpreter' works for instruction stepping."""
 
@@ -373,6 +377,7 @@
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+    @skipIfLinuxGcc("llvm.org/pr23139", compiler_version=[">=","4.9"], archs="i386")
     def test_lldbmi_exec_finish(self):
         """Test that 'lldb-mi --interpreter' works for -exec-finish."""
 
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to