aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-09-21 16:18:28 +0000
committerZachary Turner <zturner@google.com>2017-09-21 16:18:28 +0000
commit2462b0299b02493822434ba165930c8feeb59dd1 (patch)
tree481f91e649ca31808dfcb515f4dfd46f032758dd /cmake
parent5185caa70db4611c18ee6e6c2529dd5e345f0a15 (diff)
downloadllvm-2462b0299b02493822434ba165930c8feeb59dd1.tar.gz
[lit] Add a test for the builtin config map.
Config map is not exposed through the command line, so testing this is somewhat tricky. But basically we need a test that if a custom driver builds a config map and passes it to main, it gets respected. A config map allows config files in the source tree to be mapped to alternate config files in the build tree. This particular test works by having two config files in separate directories, and setting up a config map to have that redirects A/lit.site.cfg to B/altconfig. Then, we print a message in A/lit.site.cfg and B/altconfig and check that we do see the output from B but don't see the output from A. Additionally we test that the test suite specified by A's config map is properly discovered. Differential Revision: https://reviews.llvm.org/D38105 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddLLVM.cmake9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index f328e049764..81e7211ef97 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -1113,10 +1113,14 @@ endfunction(llvm_canonicalize_cmake_booleans)
# common variables that any Lit instance is likely to need, and custom
# variables can be passed in.
function(configure_lit_site_cfg site_in site_out)
- cmake_parse_arguments(ARG "" "" "MAIN_CONFIG" ${ARGN})
+ cmake_parse_arguments(ARG "" "" "MAIN_CONFIG;OUTPUT_MAPPING" ${ARGN})
if ("${ARG_MAIN_CONFIG}" STREQUAL "")
- set(ARG_MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg")
+ get_filename_component(INPUT_DIR ${site_in} DIRECTORY)
+ set(ARG_MAIN_CONFIG "${INPUT_DIR}/lit.cfg")
+ endif()
+ if ("${ARG_OUTPUT_MAPPING}" STREQUAL "")
+ set(ARG_OUTPUT_MAPPING "${site_out}")
endif()
foreach(c ${LLVM_TARGETS_TO_BUILD})
@@ -1184,7 +1188,6 @@ function(configure_lit_site_cfg site_in site_out)
"lit.llvm.initialize(lit_config, config)\n")
configure_file(${site_in} ${site_out} @ONLY)
- get_filename_component(INPUT_DIR ${site_in} DIRECTORY)
if (EXISTS "${ARG_MAIN_CONFIG}")
set(PYTHON_STATEMENT "map_config('${ARG_MAIN_CONFIG}', '${site_out}')")
get_property(LLVM_LIT_CONFIG_MAP GLOBAL PROPERTY LLVM_LIT_CONFIG_MAP)