Add icc support to the test suite
-adds icc to the lit of compilers to run the tests
-adds icc test decorators
-skip TestAnonymous.py for icc

Patch by Ashok Thirumurthi.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@177174 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lldbtest.py b/test/lldbtest.py
index f29d947..503e89b 100644
--- a/test/lldbtest.py
+++ b/test/lldbtest.py
@@ -440,6 +440,42 @@
               return wrapper
         return expectedFailureClang_impl
 
+def expectedFailureIcc(bugnumber=None):
+     if callable(bugnumber):
+        @wraps(bugnumber)
+        def expectedFailureIcc_easy_wrapper(*args, **kwargs):
+            from unittest2 import case
+            self = args[0]
+            test_compiler = self.getCompiler()
+            try:
+                bugnumber(*args, **kwargs)
+            except Exception:
+                if "icc" in test_compiler:
+                    raise case._ExpectedFailure(sys.exc_info(),None)
+                else:
+                    raise
+            if "icc" in test_compiler:
+                raise case._UnexpectedSuccess(sys.exc_info(),None)
+        return expectedFailureIcc_easy_wrapper
+     else:
+        def expectedFailureIcc_impl(func):
+              @wraps(func)
+              def wrapper(*args, **kwargs):
+                from unittest2 import case
+                self = args[0]
+                test_compiler = self.getCompiler()
+                try:
+                    func(*args, **kwargs)
+                except Exception:
+                    if "icc" in test_compiler:
+                        raise case._ExpectedFailure(sys.exc_info(),bugnumber)
+                    else:
+                        raise
+                if "icc" in test_compiler:
+                    raise case._UnexpectedSuccess(sys.exc_info(),bugnumber)
+              return wrapper
+        return expectedFailureIcc_impl
+
 
 def expectedFailurei386(bugnumber=None):
      if callable(bugnumber):
@@ -543,6 +579,21 @@
             func(*args, **kwargs)
     return wrapper
 
+def skipIfIcc(func):
+    """Decorate the item to skip tests that should be skipped if building with icc ."""
+    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+        raise Exception("@skipIfIcc can only be used to decorate a test method")
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        from unittest2 import case
+        self = args[0]
+        compiler = self.getCompiler()
+        if "icc" in compiler:
+            self.skipTest("skipping because icc is the test compiler")
+        else:
+            func(*args, **kwargs)
+    return wrapper
+
 class Base(unittest2.TestCase):
     """
     Abstract base for performing lldb (see TestBase) or other generic tests (see