Skip to content

Commit b7804ef

Browse files
committed
[Analysis] Only run plugins tests if plugins are actually enabled
When plugins aren't enabled, don't try to run plugins tests. Don't enable plugins unconditionally based on the platform, instead check if LLVM shared library is actually being built which may not be the case for every host configuration, even if the host itself supports plugins. This addresses test failures introduced by r360891/D59464. Differential Revision: https://reviews.llvm.org/D62050 llvm-svn: 360991
1 parent ad7199f commit b7804ef

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

clang/test/Analysis/checker-plugins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
// REQUIRES: plugins
2+
13
// RUN: %clang_analyze_cc1 -verify %s \
24
// RUN: -load %llvmshlibdir/SampleAnalyzerPlugin%pluginext \
35
// RUN: -analyzer-checker='example.MainCallChecker'
46

5-
// REQUIRES: plugins
6-
77
// Test that the MainCallChecker example analyzer plugin loads and runs.
88

99
int main();

clang/test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ llvm_canonicalize_cmake_booleans(
2424
CLANG_ENABLE_STATIC_ANALYZER
2525
ENABLE_BACKTRACES
2626
HAVE_LIBZ
27-
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
27+
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
28+
LLVM_ENABLE_PLUGINS)
2829

2930
configure_lit_site_cfg(
3031
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in

clang/test/lit.cfg.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,7 @@
8585
os.path.join(config.clang_tools_dir, 'hmaptool'))))
8686

8787
# Plugins (loadable modules)
88-
# TODO: This should be supplied by Makefile or autoconf.
89-
if sys.platform in ['win32', 'cygwin']:
90-
has_plugins = config.enable_shared
91-
else:
92-
has_plugins = True
93-
94-
if has_plugins and config.llvm_plugin_ext:
88+
if config.has_plugins and config.llvm_plugin_ext:
9589
config.available_features.add('plugins')
9690

9791
# Set available features we allow tests to conditionalize on.

clang/test/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ config.enable_backtrace = @ENABLE_BACKTRACES@
2727
config.host_arch = "@HOST_ARCH@"
2828
config.python_executable = "@PYTHON_EXECUTABLE@"
2929
config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@")
30+
config.has_plugins = @LLVM_ENABLE_PLUGINS@
3031

3132
# Support substitution of the tools and libs dirs with user parameters. This is
3233
# used when we can't determine the tool dir at configuration time.

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -920,14 +920,10 @@ endif()
920920

921921
# Plugin support
922922
# FIXME: Make this configurable.
923-
if(WIN32 OR CYGWIN)
924-
if(BUILD_SHARED_LIBS OR LLVM_BUILD_LLVM_DYLIB)
925-
set(LLVM_ENABLE_PLUGINS ON)
926-
else()
927-
set(LLVM_ENABLE_PLUGINS OFF)
928-
endif()
929-
else()
923+
if(BUILD_SHARED_LIBS OR LLVM_BUILD_LLVM_DYLIB)
930924
set(LLVM_ENABLE_PLUGINS ON)
925+
else()
926+
set(LLVM_ENABLE_PLUGINS OFF)
931927
endif()
932928

933929
# By default we should enable LLVM_ENABLE_IDE only for multi-configuration

0 commit comments

Comments
 (0)