summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-04-25 20:16:24 +0000
committerReid Kleckner <rnk@google.com>2018-04-25 20:16:24 +0000
commite765d633c4be0a33e9f9705b6effb3a2b15cac57 (patch)
tree392a9e18d0d504be2fe6c4b7c52d7c13a4da8278
parentdce46fa1cf10f6f2714791688e56067362646a6d (diff)
downloadbcm5719-llvm-e765d633c4be0a33e9f9705b6effb3a2b15cac57.tar.gz
bcm5719-llvm-e765d633c4be0a33e9f9705b6effb3a2b15cac57.zip
Fix PluginsTests failure on Windows buildbots by enabling it everywhere
lit is picking up a stale executable in the unittests tree, which is failing on Windows. To simplify the CMake and avoid problems like this in the future, now we always compile the test, but the test exits successfully when plugins are not enabled. llvm-svn: 330867
-rw-r--r--llvm/unittests/Passes/CMakeLists.txt38
-rw-r--r--llvm/unittests/Passes/PluginsTest.cpp5
2 files changed, 26 insertions, 17 deletions
diff --git a/llvm/unittests/Passes/CMakeLists.txt b/llvm/unittests/Passes/CMakeLists.txt
index a64f809f11c..d26ee5054f6 100644
--- a/llvm/unittests/Passes/CMakeLists.txt
+++ b/llvm/unittests/Passes/CMakeLists.txt
@@ -1,26 +1,30 @@
set(LLVM_LINK_COMPONENTS Support Passes Core)
+# If plugins are disabled, this test will disable itself at runtime. Otherwise,
+# reconfiguring with plugins disabled will leave behind a stale executable.
if (LLVM_ENABLE_PLUGINS)
- add_llvm_unittest(PluginsTests PluginsTest.cpp)
- export_executable_symbols(PluginsTests)
+ add_definitions(-DLLVM_ENABLE_PLUGINS)
+endif()
- add_library(TestPlugin MODULE TestPlugin.cxx)
+add_llvm_unittest(PluginsTests PluginsTest.cpp)
+export_executable_symbols(PluginsTests)
- set_output_directory(TestPlugin
- BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
- LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
- )
+add_library(TestPlugin MODULE TestPlugin.cxx)
- set_target_properties(TestPlugin
- PROPERTIES PREFIX ""
- SUFFIX ".so"
- )
+set_output_directory(TestPlugin
+ BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
+ LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
+ )
- if (WIN32 OR CYGWIN OR LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)
- llvm_map_components_to_libnames(LLVM_DEPS ${LLVM_LINK_COMPONENTS})
- target_link_libraries(TestPlugin ${LLVM_DEPS})
- endif()
+set_target_properties(TestPlugin
+ PROPERTIES PREFIX ""
+ SUFFIX ".so"
+ )
- add_dependencies(TestPlugin intrinsics_gen)
- add_dependencies(PluginsTests TestPlugin)
+if (WIN32 OR CYGWIN OR LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)
+ llvm_map_components_to_libnames(LLVM_DEPS ${LLVM_LINK_COMPONENTS})
+ target_link_libraries(TestPlugin ${LLVM_DEPS})
endif()
+
+add_dependencies(TestPlugin intrinsics_gen)
+add_dependencies(PluginsTests TestPlugin)
diff --git a/llvm/unittests/Passes/PluginsTest.cpp b/llvm/unittests/Passes/PluginsTest.cpp
index ad5c75cfc3a..8ec43d16c59 100644
--- a/llvm/unittests/Passes/PluginsTest.cpp
+++ b/llvm/unittests/Passes/PluginsTest.cpp
@@ -37,6 +37,11 @@ static std::string LibPath(const std::string Name = "TestPlugin") {
}
TEST(PluginsTests, LoadPlugin) {
+#if !defined(LLVM_ENABLE_PLUGINS)
+ // Disable the test if plugins are disabled.
+ return;
+#endif
+
auto PluginPath = LibPath();
ASSERT_NE("", PluginPath);
OpenPOWER on IntegriCloud