forked from OSchip/llvm-project
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
# -*- Python -*-
|
|
|
|
import os
|
|
|
|
# Setup config name.
|
|
config.name = 'XRay' + config.name_suffix
|
|
|
|
# Setup source root.
|
|
config.test_source_root = os.path.dirname(__file__)
|
|
|
|
# Setup default compiler flags use with -fxray-instrument option.
|
|
clang_xray_cflags = (['-fxray-instrument', config.target_cflags])
|
|
clang_xray_cxxflags = config.cxx_mode_flags + clang_xray_cflags
|
|
|
|
|
|
def build_invocation(compile_flags):
|
|
return ' ' + ' '.join([config.clang] + compile_flags) + ' '
|
|
|
|
# Assume that llvm-xray is in the config.llvm_tools_dir.
|
|
llvm_xray = os.path.join(config.llvm_tools_dir, 'llvm-xray')
|
|
|
|
# Setup substitutions.
|
|
config.substitutions.append(
|
|
('%clang ', build_invocation([config.target_cflags])))
|
|
config.substitutions.append(
|
|
('%clangxx ',
|
|
build_invocation(config.cxx_mode_flags + [config.target_cflags])))
|
|
config.substitutions.append(
|
|
('%clang_xray ', build_invocation(clang_xray_cflags)))
|
|
config.substitutions.append(
|
|
('%clangxx_xray', build_invocation(clang_xray_cxxflags)))
|
|
config.substitutions.append(
|
|
('%llvm_xray', llvm_xray))
|
|
|
|
# Default test suffixes.
|
|
config.suffixes = ['.c', '.cc', '.cpp']
|
|
|
|
if config.host_os not in ['Linux']:
|
|
config.unsupported = True
|
|
elif '64' not in config.host_arch:
|
|
if 'arm' in config.host_arch:
|
|
if '-mthumb' in config.target_cflags:
|
|
config.unsupported = True
|
|
else:
|
|
config.unsupported = True
|
|
|
|
# Allow tests to use REQUIRES=stable-runtime. For use when you cannot use XFAIL
|
|
# e.g. because the test sometimes passes, sometimes fails.
|
|
if config.target_arch != 'aarch64':
|
|
config.available_features.add('stable-runtime')
|