[PATCH] D150937: [clang-repl] Disable all tests on unsupported platforms
junaire abandoned this revision. junaire added a comment. This isn't an ideal solution after an off-list discussion. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150937/new/ https://reviews.llvm.org/D150937 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D150937: [clang-repl] Disable all tests on unsupported platforms
v.g.vassilev added a comment. I would support this change but instead of asking the JIT we should just add `-fsyntax-only` to these invocations as they do not rely on the JIT at all. Comment at: clang/test/Interpreter/incremental-mode.cpp:3 // RUN: clang-repl -Xcc -emit-llvm +// UNSUPPORTED: system-aix // expected-no-diagnostics This test does not run anything, so this should be supported. Perhaps we could add `-fsyntax-only` mode to the RUN lines above. Comment at: clang/unittests/Interpreter/IncrementalProcessingTest.cpp:74 +return; std::vector ClangArgv = {"-Xclang", "-emit-llvm-only"}; auto CI = llvm::cantFail(IncrementalCompilerBuilder::create(ClangArgv)); Likewise, here `-fsyntax-only` mode should be enough since we do not execute anything. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150937/new/ https://reviews.llvm.org/D150937 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D150937: [clang-repl] Disable all tests on unsupported platforms
junaire updated this revision to Diff 523697. junaire added a comment. . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150937/new/ https://reviews.llvm.org/D150937 Files: clang/test/Interpreter/incremental-mode.cpp clang/unittests/Interpreter/IncrementalProcessingTest.cpp clang/unittests/Interpreter/InterpreterTest.cpp Index: clang/unittests/Interpreter/InterpreterTest.cpp === --- clang/unittests/Interpreter/InterpreterTest.cpp +++ clang/unittests/Interpreter/InterpreterTest.cpp @@ -40,6 +40,15 @@ REPL_EXTERNAL_VISIBILITY void setGlobal(int val) { Global = val; } namespace { + +bool HostSupportsJit() { + auto J = llvm::orc::LLJITBuilder().create(); + if (J) +return true; + LLVMConsumeError(llvm::wrap(J.takeError())); + return false; +} + using Args = std::vector; static std::unique_ptr createInterpreter(const Args = {}, @@ -56,7 +65,14 @@ return std::distance(PTUDecl->decls().begin(), PTUDecl->decls().end()); } +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_Sanity) { +#else TEST(InterpreterTest, Sanity) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; std::unique_ptr Interp = createInterpreter(); using PTU = PartialTranslationUnit; @@ -72,7 +88,14 @@ return llvm::cast(D)->getQualifiedNameAsString(); } +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_IncrementalInputTopLevelDecls) { +#else TEST(InterpreterTest, IncrementalInputTopLevelDecls) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; std::unique_ptr Interp = createInterpreter(); auto R1 = Interp->Parse("int var1 = 42; int f() { return var1; }"); // gtest doesn't expand into explicit bool conversions. @@ -89,7 +112,14 @@ EXPECT_EQ("var2", DeclToString(*R2DeclRange.begin())); } +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_Errors) { +#else TEST(InterpreterTest, Errors) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; Args ExtraArgs = {"-Xclang", "-diagnostic-log-file", "-Xclang", "-"}; // Create the diagnostic engine with unowned consumer. @@ -112,7 +142,14 @@ // Here we test whether the user can mix declarations and statements. The // interpreter should be smart enough to recognize the declarations from the // statements and wrap the latter into a declaration, producing valid code. +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_DeclsAndStatements) { +#else TEST(InterpreterTest, DeclsAndStatements) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; Args ExtraArgs = {"-Xclang", "-diagnostic-log-file", "-Xclang", "-"}; // Create the diagnostic engine with unowned consumer. @@ -134,7 +171,14 @@ EXPECT_TRUE(!!R2); } +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_UndoCommand) { +#else TEST(InterpreterTest, UndoCommand) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; Args ExtraArgs = {"-Xclang", "-diagnostic-log-file", "-Xclang", "-"}; // Create the diagnostic engine with unowned consumer. @@ -188,14 +232,6 @@ return RawStr.str(); } -static bool HostSupportsJit() { - auto J = llvm::orc::LLJITBuilder().create(); - if (J) -return true; - LLVMConsumeError(llvm::wrap(J.takeError())); - return false; -} - struct LLVMInitRAII { LLVMInitRAII() { llvm::InitializeNativeTarget(); @@ -209,6 +245,9 @@ #else TEST(IncrementalProcessing, FindMangledNameSymbol) { #endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; std::unique_ptr Interp = createInterpreter(); @@ -216,11 +255,6 @@ EXPECT_EQ(1U, DeclsSize(PTU.TUPart)); auto R1DeclRange = PTU.TUPart->decls(); - // We cannot execute on the platform. - if (!HostSupportsJit()) { -return; - } - NamedDecl *FD = cast(*R1DeclRange.begin()); // Lower the PTU if (llvm::Error Err = Interp->Execute(PTU)) { @@ -276,6 +310,10 @@ #else TEST(IncrementalProcessing, InstantiateTemplate) { #endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; + // FIXME: We cannot yet handle delayed template parsing. If we run with // -fdelayed-template-parsing we try adding the newly created decl to the // active PTU which causes an assert. @@ -292,11 +330,6 @@ auto PTUDeclRange = PTU.TUPart->decls(); EXPECT_EQ(1, std::distance(PTUDeclRange.begin(), PTUDeclRange.end())); - // We cannot execute on the platform. - if (!HostSupportsJit()) { -return; - } - // Lower the PTU if (llvm::Error Err = Interp->Execute(PTU)) { // We cannot execute on the platform. Index: clang/unittests/Interpreter/IncrementalProcessingTest.cpp
[PATCH] D150937: [clang-repl] Disable all tests on unsupported platforms
junaire created this revision. Herald added a project: All. junaire requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Signed-off-by: Jun Zhang Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D150937 Files: clang/unittests/Interpreter/IncrementalProcessingTest.cpp clang/unittests/Interpreter/InterpreterTest.cpp Index: clang/unittests/Interpreter/InterpreterTest.cpp === --- clang/unittests/Interpreter/InterpreterTest.cpp +++ clang/unittests/Interpreter/InterpreterTest.cpp @@ -40,6 +40,15 @@ REPL_EXTERNAL_VISIBILITY void setGlobal(int val) { Global = val; } namespace { + +bool HostSupportsJit() { + auto J = llvm::orc::LLJITBuilder().create(); + if (J) +return true; + LLVMConsumeError(llvm::wrap(J.takeError())); + return false; +} + using Args = std::vector; static std::unique_ptr createInterpreter(const Args = {}, @@ -56,7 +65,14 @@ return std::distance(PTUDecl->decls().begin(), PTUDecl->decls().end()); } +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_Sanity) { +#else TEST(InterpreterTest, Sanity) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; std::unique_ptr Interp = createInterpreter(); using PTU = PartialTranslationUnit; @@ -72,7 +88,14 @@ return llvm::cast(D)->getQualifiedNameAsString(); } +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_IncrementalInputTopLevelDecls) { +#else TEST(InterpreterTest, IncrementalInputTopLevelDecls) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; std::unique_ptr Interp = createInterpreter(); auto R1 = Interp->Parse("int var1 = 42; int f() { return var1; }"); // gtest doesn't expand into explicit bool conversions. @@ -89,7 +112,14 @@ EXPECT_EQ("var2", DeclToString(*R2DeclRange.begin())); } +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_Errors) { +#else TEST(InterpreterTest, Errors) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; Args ExtraArgs = {"-Xclang", "-diagnostic-log-file", "-Xclang", "-"}; // Create the diagnostic engine with unowned consumer. @@ -112,7 +142,14 @@ // Here we test whether the user can mix declarations and statements. The // interpreter should be smart enough to recognize the declarations from the // statements and wrap the latter into a declaration, producing valid code. +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_DeclsAndStatements) { +#else TEST(InterpreterTest, DeclsAndStatements) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; Args ExtraArgs = {"-Xclang", "-diagnostic-log-file", "-Xclang", "-"}; // Create the diagnostic engine with unowned consumer. @@ -134,7 +171,14 @@ EXPECT_TRUE(!!R2); } +#ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC +TEST(InterpreterTest, DISABLED_UndoCommand) { +#else TEST(InterpreterTest, UndoCommand) { +#endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; Args ExtraArgs = {"-Xclang", "-diagnostic-log-file", "-Xclang", "-"}; // Create the diagnostic engine with unowned consumer. @@ -188,14 +232,6 @@ return RawStr.str(); } -static bool HostSupportsJit() { - auto J = llvm::orc::LLJITBuilder().create(); - if (J) -return true; - LLVMConsumeError(llvm::wrap(J.takeError())); - return false; -} - struct LLVMInitRAII { LLVMInitRAII() { llvm::InitializeNativeTarget(); @@ -209,6 +245,9 @@ #else TEST(IncrementalProcessing, FindMangledNameSymbol) { #endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; std::unique_ptr Interp = createInterpreter(); @@ -216,11 +255,6 @@ EXPECT_EQ(1U, DeclsSize(PTU.TUPart)); auto R1DeclRange = PTU.TUPart->decls(); - // We cannot execute on the platform. - if (!HostSupportsJit()) { -return; - } - NamedDecl *FD = cast(*R1DeclRange.begin()); // Lower the PTU if (llvm::Error Err = Interp->Execute(PTU)) { @@ -276,6 +310,10 @@ #else TEST(IncrementalProcessing, InstantiateTemplate) { #endif + // We cannot execute on the platform. + if (!HostSupportsJit()) +return; + // FIXME: We cannot yet handle delayed template parsing. If we run with // -fdelayed-template-parsing we try adding the newly created decl to the // active PTU which causes an assert. @@ -292,11 +330,6 @@ auto PTUDeclRange = PTU.TUPart->decls(); EXPECT_EQ(1, std::distance(PTUDeclRange.begin(), PTUDeclRange.end())); - // We cannot execute on the platform. - if (!HostSupportsJit()) { -return; - } - // Lower the PTU if (llvm::Error Err = Interp->Execute(PTU)) { // We cannot execute on the platform. Index: clang/unittests/Interpreter/IncrementalProcessingTest.cpp