[llvm] r330867 - Fix PluginsTests failure on Windows buildbots by enabling it everywhere
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 25 13:16:25 PDT 2018
Author: rnk
Date: Wed Apr 25 13:16:24 2018
New Revision: 330867
URL: http://llvm.org/viewvc/llvm-project?rev=330867&view=rev
Log:
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.
Modified:
llvm/trunk/unittests/Passes/CMakeLists.txt
llvm/trunk/unittests/Passes/PluginsTest.cpp
Modified: llvm/trunk/unittests/Passes/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Passes/CMakeLists.txt?rev=330867&r1=330866&r2=330867&view=diff
==============================================================================
--- llvm/trunk/unittests/Passes/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Passes/CMakeLists.txt Wed Apr 25 13:16:24 2018
@@ -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}
- )
-
- set_target_properties(TestPlugin
- PROPERTIES PREFIX ""
- SUFFIX ".so"
- )
-
- 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_library(TestPlugin MODULE TestPlugin.cxx)
- add_dependencies(TestPlugin intrinsics_gen)
- add_dependencies(PluginsTests TestPlugin)
+set_output_directory(TestPlugin
+ BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
+ LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
+ )
+
+set_target_properties(TestPlugin
+ PROPERTIES PREFIX ""
+ SUFFIX ".so"
+ )
+
+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)
Modified: llvm/trunk/unittests/Passes/PluginsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Passes/PluginsTest.cpp?rev=330867&r1=330866&r2=330867&view=diff
==============================================================================
--- llvm/trunk/unittests/Passes/PluginsTest.cpp (original)
+++ llvm/trunk/unittests/Passes/PluginsTest.cpp Wed Apr 25 13:16:24 2018
@@ -37,6 +37,11 @@ static std::string LibPath(const std::st
}
TEST(PluginsTests, LoadPlugin) {
+#if !defined(LLVM_ENABLE_PLUGINS)
+ // Disable the test if plugins are disabled.
+ return;
+#endif
+
auto PluginPath = LibPath();
ASSERT_NE("", PluginPath);
More information about the llvm-commits
mailing list