From 4ec0ef8a5ee1fd59b62a13d9d1c6b7cd29611ca5 Mon Sep 17 00:00:00 2001 From: Don Hinton Date: Tue, 28 May 2019 06:38:16 +0000 Subject: [PATCH] Revert [test] Fix plugin tests This reverts r361790 (git commit fe5eaab2b5b4523886bd63aebcfea8cfce586fa1) It's causing buildbot breakage, so reverting while I investigate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361793 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/CMakeLists.txt | 2 -- lib/Analysis/plugins/CMakeLists.txt | 5 ---- .../plugins/SampleAnalyzer/CMakeLists.txt | 10 ------- test/Analysis/lit.local.cfg | 2 ++ test/Analysis/plugins/CMakeLists.txt | 12 +++++++++ .../CheckerDependencyHandling/CMakeLists.txt | 15 ++++++----- .../CheckerDependencyHandling.cpp | 0 ...erDependencyHandlingAnalyzerPlugin.exports | 0 .../CheckerOptionHandling/CMakeLists.txt | 15 ++++++----- .../CheckerOptionHandling.cpp | 0 ...heckerOptionHandlingAnalyzerPlugin.exports | 0 .../plugins/SampleAnalyzer/CMakeLists.txt | 11 ++++++++ .../SampleAnalyzer/MainCallChecker.cpp | 0 .../SampleAnalyzerPlugin.exports | 0 test/CMakeLists.txt | 26 ++++++++++++++----- 15 files changed, 61 insertions(+), 37 deletions(-) delete mode 100644 lib/Analysis/plugins/CMakeLists.txt delete mode 100644 lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt create mode 100644 test/Analysis/plugins/CMakeLists.txt rename {lib => test}/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt (51%) rename {lib => test}/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp (100%) rename {lib => test}/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports (100%) rename {lib => test}/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt (50%) rename {lib => test}/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp (100%) rename {lib => test}/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports (100%) create mode 100644 test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt rename {lib => test}/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp (100%) rename {lib => test}/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports (100%) diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt index 9271714346..940a3dfe6f 100644 --- a/lib/Analysis/CMakeLists.txt +++ b/lib/Analysis/CMakeLists.txt @@ -34,5 +34,3 @@ add_clang_library(clangAnalysis clangBasic clangLex ) - -add_subdirectory(plugins) diff --git a/lib/Analysis/plugins/CMakeLists.txt b/lib/Analysis/plugins/CMakeLists.txt deleted file mode 100644 index f7dbc93695..0000000000 --- a/lib/Analysis/plugins/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -if(LLVM_ENABLE_PLUGINS) - add_subdirectory(SampleAnalyzer) - add_subdirectory(CheckerDependencyHandling) - add_subdirectory(CheckerOptionHandling) -endif() diff --git a/lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt b/lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt deleted file mode 100644 index 639a97f253..0000000000 --- a/lib/Analysis/plugins/SampleAnalyzer/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/SampleAnalyzerPlugin.exports) -add_llvm_library(SampleAnalyzerPlugin MODULE MainCallChecker.cpp PLUGIN_TOOL clang) - -target_link_libraries(SampleAnalyzerPlugin PRIVATE - clangAnalysis - clangAST - clangStaticAnalyzerCore - clangStaticAnalyzerFrontend - LLVMSupport - ) diff --git a/test/Analysis/lit.local.cfg b/test/Analysis/lit.local.cfg index 84f7569152..b77cae8ece 100644 --- a/test/Analysis/lit.local.cfg +++ b/test/Analysis/lit.local.cfg @@ -18,5 +18,7 @@ config.substitutions.append(('%diff_plist', config.substitutions.append(('%diff_sarif', '''diff -U1 -w -I ".*file:.*%basename_t" -I '"version":' -I "2\.0\.0\-csd\.[0-9]*\.beta\."''')) +config.excludes.add('plugins') + if not config.root.clang_staticanalyzer: config.unsupported = True diff --git a/test/Analysis/plugins/CMakeLists.txt b/test/Analysis/plugins/CMakeLists.txt new file mode 100644 index 0000000000..8d4333f99a --- /dev/null +++ b/test/Analysis/plugins/CMakeLists.txt @@ -0,0 +1,12 @@ +add_subdirectory(SampleAnalyzer) +add_subdirectory(CheckerDependencyHandling) +add_subdirectory(CheckerOptionHandling) + +set(CLANG_ANALYZER_PLUGIN_DEPS + SampleAnalyzerPlugin + CheckerDependencyHandlingAnalyzerPlugin + CheckerOptionHandlingAnalyzerPlugin + ) + +add_custom_target(clang-analyzer-plugin + DEPENDS ${CLANG_ANALYZER_PLUGIN_DEPS}) diff --git a/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt b/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt similarity index 51% rename from lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt rename to test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt index 0a8ff48755..80e2cdbd3a 100644 --- a/lib/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt +++ b/test/Analysis/plugins/CheckerDependencyHandling/CMakeLists.txt @@ -1,10 +1,11 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CheckerDependencyHandlingAnalyzerPlugin.exports) add_llvm_library(CheckerDependencyHandlingAnalyzerPlugin MODULE CheckerDependencyHandling.cpp PLUGIN_TOOL clang) -target_link_libraries(CheckerDependencyHandlingAnalyzerPlugin PRIVATE - clangAnalysis - clangAST - clangStaticAnalyzerCore - clangStaticAnalyzerFrontend - LLVMSupport - ) +if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN)) + target_link_libraries(CheckerDependencyHandlingAnalyzerPlugin PRIVATE + clangAnalysis + clangAST + clangStaticAnalyzerCore + LLVMSupport + ) +endif() diff --git a/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp b/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp similarity index 100% rename from lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp rename to test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp diff --git a/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports b/test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports similarity index 100% rename from lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports rename to test/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandlingAnalyzerPlugin.exports diff --git a/lib/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt b/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt similarity index 50% rename from lib/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt rename to test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt index 6e289933c2..6a1d5e8527 100644 --- a/lib/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt +++ b/test/Analysis/plugins/CheckerOptionHandling/CMakeLists.txt @@ -1,10 +1,11 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/CheckerOptionHandlingAnalyzerPlugin.exports) add_llvm_library(CheckerOptionHandlingAnalyzerPlugin MODULE CheckerOptionHandling.cpp PLUGIN_TOOL clang) -target_link_libraries(CheckerOptionHandlingAnalyzerPlugin PRIVATE - clangAnalysis - clangAST - clangStaticAnalyzerCore - clangStaticAnalyzerFrontend - LLVMSupport - ) +if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN)) + target_link_libraries(CheckerOptionHandlingAnalyzerPlugin PRIVATE + clangAnalysis + clangAST + clangStaticAnalyzerCore + LLVMSupport + ) +endif() diff --git a/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp b/test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp similarity index 100% rename from lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp rename to test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp diff --git a/lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports b/test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports similarity index 100% rename from lib/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports rename to test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandlingAnalyzerPlugin.exports diff --git a/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt b/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt new file mode 100644 index 0000000000..7c7b2aec19 --- /dev/null +++ b/test/Analysis/plugins/SampleAnalyzer/CMakeLists.txt @@ -0,0 +1,11 @@ +set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/SampleAnalyzerPlugin.exports) +add_llvm_library(SampleAnalyzerPlugin MODULE MainCallChecker.cpp PLUGIN_TOOL clang) + +if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN)) + target_link_libraries(SampleAnalyzerPlugin PRIVATE + clangAnalysis + clangAST + clangStaticAnalyzerCore + LLVMSupport + ) +endif() diff --git a/lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp b/test/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp similarity index 100% rename from lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp rename to test/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp diff --git a/lib/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports b/test/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports similarity index 100% rename from lib/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports rename to test/Analysis/plugins/SampleAnalyzer/SampleAnalyzerPlugin.exports diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 32fe571afa..339f637847 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -126,13 +126,27 @@ if( NOT CLANG_BUILT_STANDALONE ) endif() if (CLANG_ENABLE_STATIC_ANALYZER) - if (LLVM_ENABLE_PLUGINS) - set(CLANG_ANALYZER_PLUGIN_DEPS - SampleAnalyzerPlugin - CheckerDependencyHandlingAnalyzerPlugin - CheckerOptionHandlingAnalyzerPlugin - ) + add_subdirectory(Analysis/plugins) + list(APPEND CLANG_TEST_DEPS clang-analyzer-plugin) + + # check-all would launch those tests via check-clang. + set(EXCLUDE_FROM_ALL ON) + + add_lit_testsuite(check-clang-analyzer "Running the Clang analyzer tests" + ${CMAKE_CURRENT_BINARY_DIR}/Analysis + PARAMS ${ANALYZER_TEST_PARAMS} + DEPENDS ${CLANG_TEST_DEPS}) + set_target_properties(check-clang-analyzer PROPERTIES FOLDER "Clang tests") + + if (LLVM_WITH_Z3) + add_lit_testsuite(check-clang-analyzer-z3 "Running the Clang analyzer tests, using Z3 as a solver" + ${CMAKE_CURRENT_BINARY_DIR}/Analysis + PARAMS ${ANALYZER_TEST_PARAMS_Z3} + DEPENDS ${CLANG_TEST_DEPS}) + set_target_properties(check-clang-analyzer-z3 PROPERTIES FOLDER "Clang tests") endif() + + set(EXCLUDE_FROM_ALL OFF) endif() add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS}) -- 2.40.0