[PATCH] D109625: [compiler-rt] Ensure LIT_TEST_DEP targets are actually built
Leonard Chan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 10 12:49:44 PDT 2021
leonardchan created this revision.
leonardchan added a reviewer: phosek.
Herald added subscribers: mgorny, dberris.
leonardchan requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
When building compiler-rt via runtimes, many tests fail because tools like FileCheck and count aren't built yet. If it's also through a standalone build, then compiler-rt doesn't know of these targets. This copies logic from other parts of the monorepo and adds custom commands for building these external projects if we are in the case of a runtimes build.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D109625
Files:
compiler-rt/test/CMakeLists.txt
Index: compiler-rt/test/CMakeLists.txt
===================================================================
--- compiler-rt/test/CMakeLists.txt
+++ compiler-rt/test/CMakeLists.txt
@@ -1,5 +1,6 @@
# Needed for lit support in standalone builds.
include(AddLLVM)
+include(LLVMExternalProjectUtils)
option(COMPILER_RT_TEST_STANDALONE_BUILD_LIBS
"When set to ON and testing in a standalone build, test the runtime \
@@ -28,14 +29,29 @@
# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
# and run tests with tools from the host toolchain.
if(NOT ANDROID)
- if(NOT COMPILER_RT_STANDALONE_BUILD AND NOT LLVM_RUNTIMES_BUILD)
- # Use LLVM utils and Clang from the same build tree.
- list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS
+ set(LIT_TEST_DEPS
clang clang-resource-headers FileCheck count not llvm-config llvm-nm llvm-objdump
llvm-readelf llvm-readobj llvm-size llvm-symbolizer compiler-rt-headers sancov)
- if (WIN32)
- list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
- endif()
+ if (WIN32)
+ list(APPEND LIT_TEST_DEPS KillTheDoctor)
+ endif()
+
+ if(NOT COMPILER_RT_STANDALONE_BUILD AND NOT LLVM_RUNTIMES_BUILD)
+ # Use LLVM utils and Clang from the same build tree.
+ list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS ${LIT_TEST_DEPS})
+ elseif(COMPILER_RT_STANDALONE_BUILD)
+ # If we are making a standalone build, we need to ensure some targets used
+ # for testing are known and built as deps.
+ list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS ${LIT_TEST_DEPS})
+ foreach(dep ${LIT_TEST_DEPS})
+ if (NOT TARGET ${dep})
+ llvm_ExternalProject_BuildCmd(build_${dep} ${dep} ${BINARY_DIR})
+ add_custom_target(${dep}
+ COMMAND ${build_${dep}}
+ WORKING_DIRECTORY ${BINARY_DIR}
+ VERBATIM USES_TERMINAL)
+ endif()
+ endforeach()
endif()
# Tests use C++ standard library headers.
if (TARGET cxx-headers OR HAVE_LIBCXX)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109625.371991.patch
Type: text/x-patch
Size: 1969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210910/5b04fa02/attachment.bin>
More information about the cfe-commits
mailing list