[clang-repl] Disable execution unittests on unsupported platforms.
authorSunho Kim <ksunhokim123@gmail.com>
Fri, 29 Jul 2022 17:27:45 +0000 (02:27 +0900)
committerSunho Kim <ksunhokim123@gmail.com>
Fri, 29 Jul 2022 17:28:03 +0000 (02:28 +0900)
After the intoduction of global destructor support, there is a possiblity to run invalid instructions in the destructor of Interpreter class. Completely disable tests in platforms with failing test cases.

Differential Revision: https://reviews.llvm.org/D130786

clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
clang/unittests/Interpreter/InterpreterTest.cpp

index 7a5f07e..d827c91 100644 (file)
@@ -46,6 +46,7 @@ createInterpreter(const Args &ExtraArgs = {},
 }
 
 TEST(InterpreterTest, CatchException) {
+  llvm::llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
   llvm::InitializeNativeTarget();
   llvm::InitializeNativeTargetAsmPrinter();
 
@@ -130,8 +131,6 @@ extern "C" int throw_exception() {
   EXPECT_ANY_THROW(ThrowException());
   std::string CapturedStdOut = testing::internal::GetCapturedStdout();
   EXPECT_EQ(CapturedStdOut, "Caught: 'To be caught in JIT'\n");
-
-  llvm::llvm_shutdown();
 }
 
 } // end anonymous namespace
index 745e360..d266dd0 100644 (file)
 
 using namespace clang;
 
+#if defined(_AIX) || defined(__hexagon__) ||                                   \
+    (defined(_WIN32) &&                                                        \
+     (defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__)))
+#define CLANG_INTERPRETER_NO_SUPPORT_EXEC
+#endif
+
 namespace {
 using Args = std::vector<const char *>;
 static std::unique_ptr<Interpreter>
@@ -191,7 +197,7 @@ struct LLVMInitRAII {
   ~LLVMInitRAII() { llvm::llvm_shutdown(); }
 } LLVMInit;
 
-#ifdef _AIX
+#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC
 TEST(IncrementalProcessing, DISABLED_FindMangledNameSymbol) {
 #else
 TEST(IncrementalProcessing, FindMangledNameSymbol) {
@@ -253,7 +259,7 @@ static NamedDecl *LookupSingleName(Interpreter &Interp, const char *Name) {
   return R.getFoundDecl();
 }
 
-#ifdef _AIX
+#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC
 TEST(IncrementalProcessing, DISABLED_InstantiateTemplate) {
 #else
 TEST(IncrementalProcessing, InstantiateTemplate) {