diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp --- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp @@ -17,6 +17,17 @@ using namespace llvm; +// Writing 64-bit XCOFF isn't supported yet, so we expect some tests to crash. +#if defined(_AIX) && defined(__64BIT__) +#define EXPECT_DEATH_ON_AIX_64BIT_THEN_SKIP(...) \ + do { \ + EXPECT_DEATH(__VA_ARGS__); \ + return; \ + } while (false) +#else +#define EXPECT_DEATH_ON_AIX_64BIT_THEN_SKIP(statement, regex) (statement) +#endif + // OrcCAPITestBase contains several helper methods and pointers for unit tests // written for the LLVM-C API. It provides the following helpers: // @@ -266,9 +277,15 @@ FAIL() << "Failed to add LLVM IR module to LLJIT (triple = " << TargetTriple << "): " << toString(E); LLVMOrcJITTargetAddress TestFnAddr; - if (LLVMErrorRef E = LLVMOrcLLJITLookup(Jit, &TestFnAddr, "sum")) - FAIL() << "Symbol \"sum\" was not added into JIT (triple = " << TargetTriple - << "): " << toString(E); + { + LLVMErrorRef E = nullptr; + EXPECT_DEATH_ON_AIX_64BIT_THEN_SKIP( + E = LLVMOrcLLJITLookup(Jit, &TestFnAddr, "sum"), + "64-bit XCOFF object files are not supported yet"); + if (E) + FAIL() << "Symbol \"sum\" was not added into JIT (triple = " + << TargetTriple << "): " << toString(E); + } ASSERT_TRUE(!!TestFnAddr); LLVMOrcResourceTrackerRemove(RT); LLVMOrcJITTargetAddress OutAddr; @@ -295,9 +312,15 @@ FAIL() << "Failed to add LLVM IR module to LLJIT (triple = " << TargetTriple << "): " << toString(E); LLVMOrcJITTargetAddress Addr; - if (LLVMErrorRef E = LLVMOrcLLJITLookup(Jit, &Addr, "sum")) - FAIL() << "Symbol \"sum\" was not added into JIT (triple = " << TargetTriple - << "): " << toString(E); + { + LLVMErrorRef E = nullptr; + EXPECT_DEATH_ON_AIX_64BIT_THEN_SKIP( + E = LLVMOrcLLJITLookup(Jit, &Addr, "sum"), + "64-bit XCOFF object files are not supported yet"); + if (E) + FAIL() << "Symbol \"sum\" was not added into JIT (triple = " + << TargetTriple << "): " << toString(E); + } LLVMOrcResourceTrackerTransferTo(DefaultRT, RT2); LLVMErrorRef Err = LLVMOrcLLJITLookup(Jit, &Addr, "sum"); ASSERT_FALSE(Err); @@ -319,9 +342,15 @@ FAIL() << "Failed to add LLVM IR module to LLJIT (triple = " << TargetTriple << ")" << toString(E); LLVMOrcJITTargetAddress TestFnAddr; - if (LLVMErrorRef E = LLVMOrcLLJITLookup(Jit, &TestFnAddr, "sum")) - FAIL() << "Symbol \"sum\" was not added into JIT (triple = " << TargetTriple - << "): " << toString(E); + { + LLVMErrorRef E = nullptr; + EXPECT_DEATH_ON_AIX_64BIT_THEN_SKIP( + E = LLVMOrcLLJITLookup(Jit, &TestFnAddr, "sum"), + "64-bit XCOFF object files are not supported yet"); + if (E) + FAIL() << "Symbol \"sum\" was not added into JIT (triple = " + << TargetTriple << "): " << toString(E); + } auto *SumFn = (SumFunctionType)(TestFnAddr); int32_t Result = SumFn(1, 1); ASSERT_EQ(2, Result);