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.

llvm-svn: 177174
This commit is contained in:
Matt Kopec 2013-03-15 19:10:12 +00:00
parent 6773276351
commit 0de53f062f
3 changed files with 54 additions and 2 deletions

View File

@ -16,6 +16,7 @@ class AnonymousTestCase(TestBase):
self.expr()
@skipIfGcc # llvm.org/pr15036: LLDB is unable to parse DWARF generated by GCC
@skipIfIcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC
@dwarf_test
def test_expr_with_dwarf(self):
self.buildDwarf()

View File

@ -440,6 +440,42 @@ def expectedFailureClang(bugnumber=None):
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 @@ def skipIfGcc(func):
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

View File

@ -106,10 +106,10 @@ ifneq "$(DYLIB_NAME)" ""
endif
# Function that returns the counterpart C++ compiler, given $(CC) as arg.
cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
cxx_compiler = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), if $(findstring icc,$(1)), $(subst icc,icpc,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
# Function that returns the C++ linker, given $(CC) as arg.
cxx_linker = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
cxx_linker = $(if $(findstring clang,$(1)), $(subst clang,clang++,$(1)), if $(findstring icc,$(1)), $(subst icc,icpc,$(1)), $(if $(findstring llvm-gcc,$(1)), $(subst llvm-gcc,llvm-g++,$(1)), $(subst gcc,g++,$(1))))
#----------------------------------------------------------------------
# dylib settings