@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

# 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')

# 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')
