blob: cbb39873b68c3a8e1a5419c3d805890a73c714ab [file] [edit]
@AUTO_GEN_COMMENT@
@SERIALIZED_LIT_PARAMS@
#
# This file performs the bridge between the CMake configuration and the Lit
# configuration files by setting up the LitConfig object and various Lit
# substitutions from CMake variables.
#
# Individual configuration files can take advantage of this bridge by
# loading the file and then setting up the remaining Lit substitutions.
#
import os, site
site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))
import libcxx.test.format
from lit.util import which
import re as _re
# Basic configuration of the test suite
config.name = os.path.basename('@LIBUNWIND_TEST_CONFIG@')
config.test_source_root = os.path.join('@LIBUNWIND_SOURCE_DIR@', 'test')
config.test_format = libcxx.test.format.CxxStandardLibraryTest()
config.recursiveExpansionLimit = 10
config.test_exec_root = os.path.join('@LIBUNWIND_BINARY_DIR@', 'test')
# Add a few features that are common to all the configurations
if @LIBUNWIND_USES_ARM_EHABI@:
config.available_features.add('libunwind-arm-ehabi')
if not @LIBUNWIND_ENABLE_THREADS@:
config.available_features.add('libunwind-no-threads')
# Apple uses "arm64" and "arm64e" in target triples where the canonical LLVM
# name is "aarch64". REQUIRES directives like `REQUIRES: target={{aarch64-.+}}`
# would otherwise never match on any Apple AArch64 target. Add a normalised
# alias so those directives work correctly.
_norm_triple = _re.sub(r'^arm64([^-]*)', 'aarch64', config.target_triple)
if _norm_triple != config.target_triple:
config.available_features.add('target={}'.format(_norm_triple))
# Add substitutions for bootstrapping the test suite configuration
config.substitutions.append(('%{install-prefix}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@'))
config.substitutions.append(('%{include}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/include'))
config.substitutions.append(('%{lib}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/@LIBUNWIND_INSTALL_LIBRARY_DIR@'))
config.substitutions.append(('%{benchmark_flags}', ''))
# Check for objcopy tools
objcopy_path = which('llvm-objcopy', '@LLVM_BUILD_BINARY_DIR@/bin')
if not objcopy_path:
objcopy_path = which('llvm-objcopy')
if not objcopy_path:
objcopy_path = which('objcopy')
if objcopy_path:
config.substitutions.append(('%{objcopy}', objcopy_path))
config.available_features.add('objcopy-available')