2017-07-06 23:20:12 +08:00
|
|
|
@AUTO_GEN_COMMENT@
|
2020-06-26 00:02:43 +08:00
|
|
|
|
|
|
|
import os
|
|
|
|
import site
|
|
|
|
|
2017-07-06 23:20:12 +08:00
|
|
|
config.cxx_under_test = "@LIBUNWIND_COMPILER@"
|
|
|
|
config.project_obj_root = "@CMAKE_BINARY_DIR@"
|
|
|
|
config.libunwind_src_root = "@LIBUNWIND_SOURCE_DIR@"
|
|
|
|
config.libunwind_obj_root = "@LIBUNWIND_BINARY_DIR@"
|
|
|
|
config.abi_library_path = "@LIBUNWIND_LIBRARY_DIR@"
|
|
|
|
config.libcxx_src_root = "@LIBUNWIND_LIBCXX_PATH@"
|
|
|
|
config.libunwind_headers = "@LIBUNWIND_SOURCE_DIR@/include"
|
|
|
|
config.cxx_library_root = "@LIBUNWIND_LIBCXX_LIBRARY_PATH@"
|
2019-02-05 12:44:03 +08:00
|
|
|
config.llvm_unwinder = True
|
2019-02-06 03:50:47 +08:00
|
|
|
config.builtins_library = "@LIBUNWIND_BUILTINS_LIBRARY@"
|
2019-02-05 12:44:03 +08:00
|
|
|
config.enable_threads = @LIBUNWIND_ENABLE_THREADS@
|
2017-07-06 23:20:12 +08:00
|
|
|
config.use_sanitizer = "@LLVM_USE_SANITIZER@"
|
2019-02-05 12:44:03 +08:00
|
|
|
config.enable_32bit = @LIBUNWIND_BUILD_32_BITS@
|
2017-07-06 23:20:12 +08:00
|
|
|
config.target_info = "@LIBUNWIND_TARGET_INFO@"
|
2018-02-28 02:40:04 +08:00
|
|
|
config.test_linker_flags = "@LIBUNWIND_TEST_LINKER_FLAGS@"
|
|
|
|
config.test_compiler_flags = "@LIBUNWIND_TEST_COMPILER_FLAGS@"
|
2017-07-06 23:20:12 +08:00
|
|
|
config.executor = "@LIBUNWIND_EXECUTOR@"
|
2019-02-05 12:44:03 +08:00
|
|
|
config.libunwind_shared = @LIBUNWIND_ENABLE_SHARED@
|
|
|
|
config.enable_shared = @LIBCXX_ENABLE_SHARED@
|
2019-12-06 22:26:35 +08:00
|
|
|
config.arm_ehabi = @LIBUNWIND_USES_ARM_EHABI@
|
2017-07-06 23:20:12 +08:00
|
|
|
config.host_triple = "@LLVM_HOST_TRIPLE@"
|
|
|
|
config.target_triple = "@TARGET_TRIPLE@"
|
[CMake] Support CMake variables for setting target, sysroot and toolchain
CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.
libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.
This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.
Differential Revision: https://reviews.llvm.org/D57670
llvm-svn: 353084
2019-02-05 04:02:26 +08:00
|
|
|
config.use_target = bool("@LIBUNWIND_TARGET_TRIPLE@")
|
2017-12-06 04:22:10 +08:00
|
|
|
config.sysroot = "@LIBUNWIND_SYSROOT@"
|
|
|
|
config.gcc_toolchain = "@LIBUNWIND_GCC_TOOLCHAIN@"
|
2019-02-05 12:44:03 +08:00
|
|
|
config.cxx_ext_threads = @LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY@
|
2017-07-06 23:20:12 +08:00
|
|
|
|
2020-06-26 00:02:43 +08:00
|
|
|
site.addsitedir(os.path.join(config.libunwind_src_root, 'test'))
|
|
|
|
site.addsitedir(os.path.join(config.libcxx_src_root, 'utils'))
|
|
|
|
|
|
|
|
# name: The name of this test suite.
|
|
|
|
config.name = 'libunwind'
|
|
|
|
|
|
|
|
# suffixes: A list of file extensions to treat as test files.
|
|
|
|
config.suffixes = ['.cpp', '.s']
|
|
|
|
|
|
|
|
# test_source_root: The root path where tests are located.
|
|
|
|
config.test_source_root = os.path.join(config.libunwind_src_root, 'test')
|
|
|
|
|
|
|
|
# Allow expanding substitutions that are based on other substitutions
|
|
|
|
config.recursiveExpansionLimit = 10
|
|
|
|
|
|
|
|
# Infer the test_exec_root from the build directory.
|
|
|
|
config.test_exec_root = os.path.join(config.libunwind_obj_root, 'test')
|
|
|
|
|
|
|
|
lit_config.note('Using configuration variant: libunwind')
|
|
|
|
import libunwind.test.config
|
|
|
|
configuration = libunwind.test.config.Configuration(lit_config, config)
|
|
|
|
configuration.configure()
|
|
|
|
configuration.print_config_info()
|
|
|
|
if lit_config.params.get('use_old_format', False):
|
|
|
|
lit_config.note("Using the old libc++ testing format")
|
|
|
|
config.test_format = configuration.get_test_format()
|
|
|
|
else:
|
|
|
|
lit_config.note("Using the new libc++ testing format")
|
|
|
|
import libcxx.test.newformat
|
|
|
|
config.test_format = libcxx.test.newformat.CxxStandardLibraryTest()
|