aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-09-20 16:01:50 +0000
committerZachary Turner <zturner@google.com>2017-09-20 16:01:50 +0000
commit3dd2356b3aa227aa241ab4c7e4da11d5df1045f6 (patch)
tree691bfbe153e654337e1efe632bda07c802b329d6
parent1d5d44ff05066739d95f48617ba0c12d827bc600 (diff)
downloadllvm-3dd2356b3aa227aa241ab4c7e4da11d5df1045f6.zip
llvm-3dd2356b3aa227aa241ab4c7e4da11d5df1045f6.tar.gz
llvm-3dd2356b3aa227aa241ab4c7e4da11d5df1045f6.tar.bz2
Make libcxx tests work when llvm sources are not present.
Despite a strong CMake warning that this is an unsupported libcxx build configuration, some bots still rely on being able to check out lit and libcxx independently with no LLVM sources, and then run lit against libcxx. A previous patch broke that workflow, so this is making it work again. Unfortunately, it breaks generation of the llvm-lit script for libcxx, but we will just have to live with that until a solution is found that allows libcxx to make more use of llvm build pieces. libcxx can still run tests by using the ninja check target, or by running lit.py directly against the build tree or source tree. Differential Revision: https://reviews.llvm.org/D38057 llvm-svn: 313763
-rw-r--r--libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake17
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake9
2 files changed, 16 insertions, 10 deletions
diff --git a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
index b724bf6..83948b1 100644
--- a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -111,14 +111,17 @@ macro(configure_out_of_tree_llvm)
# the configurator should write the script into.
set(LLVM_LIT_OUTPUT_DIR "${libcxx_BINARY_DIR}/bin")
- # Required LIT Configuration ------------------------------------------------
- # Define the default arguments to use with 'lit', and an option for the user
- # to override.
- set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
- if (MSVC OR XCODE)
- set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
+ if (LLVM_INCLUDE_TESTS)
+ # Required LIT Configuration ------------------------------------------------
+ # Define the default arguments to use with 'lit', and an option for the user
+ # to override.
+ set(LLVM_EXTERNAL_LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py")
+ set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
+ if (MSVC OR XCODE)
+ set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
+ endif()
+ set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
endif()
- set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
# Required doc configuration
if (LLVM_ENABLE_SPHINX)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 06840fb..7c26e396 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1198,7 +1198,12 @@ function(get_llvm_lit_path base_dir file_name)
cmake_parse_arguments(ARG "ALLOW_EXTERNAL" "" "" ${ARGN})
if (ARG_ALLOW_EXTERNAL)
+ set(LLVM_DEFAULT_EXTERNAL_LIT "${LLVM_EXTERNAL_LIT}")
set (LLVM_EXTERNAL_LIT "" CACHE STRING "Command used to spawn lit")
+ if ("${LLVM_EXTERNAL_LIT}" STREQUAL "")
+ set(LLVM_EXTERNAL_LIT "${LLVM_DEFAULT_EXTERNAL_LIT}")
+ endif()
+
if (NOT "${LLVM_EXTERNAL_LIT}" STREQUAL "")
if (EXISTS ${LLVM_EXTERNAL_LIT})
get_filename_component(LIT_FILE_NAME ${LLVM_EXTERNAL_LIT} NAME)
@@ -1230,9 +1235,7 @@ function(get_llvm_lit_path base_dir file_name)
elseif(NOT "${LLVM_RUNTIME_OUTPUT_INTDIR}" STREQUAL "")
set(LLVM_LIT_BASE_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
else()
- message(WARNING "Could not find suitable output location for llvm-lit."
- "Using default ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit")
- set(LLVM_LIT_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
+ set(LLVM_LIT_BASE_DIR "")
endif()
# Cache this so we don't have to do it again and have subsequent calls