diff --git a/lldb/test/lang/c/anonymous/TestAnonymous.py b/lldb/test/lang/c/anonymous/TestAnonymous.py index c863112f0291..c7efac4b7a7d 100644 --- a/lldb/test/lang/c/anonymous/TestAnonymous.py +++ b/lldb/test/lang/c/anonymous/TestAnonymous.py @@ -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() diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index f29d947f6fd1..503e89b2d496 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -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 diff --git a/lldb/test/make/Makefile.rules b/lldb/test/make/Makefile.rules index e065eb1d0853..7f4e01c6d495 100644 --- a/lldb/test/make/Makefile.rules +++ b/lldb/test/make/Makefile.rules @@ -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