Fix check-lit compatibility with multi-config CMake generators · llvm/llvm-project@fd2c379 (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
1 1 # The configured file is not placed in the correct location
2 2 # until the tests are run as we need to copy it into
3 3 # a copy of the tests folder
4 -configure_file("tests/lit.site.cfg.in" "lit.site.cfg" @ONLY)
4 +configure_lit_site_cfg("tests/lit.site.cfg.in" "lit.site.cfg")
5 5
6 6 # Lit's test suite creates output files next to the sources which makes the
7 7 # source tree dirty. This is undesirable because we do out of source builds.
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
1 -## Autogenerated by LLVM/Clang configuration.
2 -# Do not edit!
1 +@LIT_SITE_CFG_IN_HEADER@
2 +
3 +import sys
4 +
3 5 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
4 6 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
5 -config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@"
7 +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
8 +
9 +# Support substitution of the tools_dir with user parameters.
10 +# This is used when we can't determine the tool dir at configuration time.
11 +try:
12 + config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
13 +except KeyError:
14 + e = sys.exc_info()[1]
15 + key, = e.args
16 + lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
6 17
7 18 # Let the main config do the real work.
8 19 lit_config.load_config(config, "@LLVM_BINARY_DIR@/utils/lit/tests/lit.cfg")