• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@LIT_SITE_CFG_IN_HEADER@
2
3# Set attribute value if it is unset.
4def set_default(attr, value):
5  if not getattr(config, attr, None):
6    setattr(config, attr, value)
7
8# Generic config options for all compiler-rt lit tests.
9set_default("target_triple", "@COMPILER_RT_DEFAULT_TARGET_TRIPLE@")
10set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_CFLAGS@")
11set_default("host_arch", "@HOST_ARCH@")
12set_default("target_arch", "@COMPILER_RT_DEFAULT_TARGET_ARCH@")
13set_default("host_os", "@HOST_OS@")
14set_default("llvm_build_mode", "@LLVM_BUILD_MODE@")
15set_default("llvm_src_root", "@LLVM_MAIN_SRC_DIR@")
16set_default("llvm_obj_root", "@LLVM_BINARY_DIR@")
17set_default("compiler_rt_src_root", "@COMPILER_RT_SOURCE_DIR@")
18set_default("compiler_rt_obj_root", "@COMPILER_RT_BINARY_DIR@")
19set_default("enable_per_target_runtime_dir", @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL@)
20set_default("llvm_tools_dir", "@LLVM_TOOLS_DIR@")
21set_default("llvm_shlib_dir", "@LLVM_LIBRARY_OUTPUT_INTDIR@")
22set_default("gnu_ld_executable", "@GNU_LD_EXECUTABLE@")
23set_default("gold_executable", "@GOLD_EXECUTABLE@")
24set_default("clang", "@COMPILER_RT_RESOLVED_TEST_COMPILER@")
25set_default("compiler_id", "@COMPILER_RT_TEST_COMPILER_ID@")
26set_default("python_executable", "@Python3_EXECUTABLE@")
27set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
28set_default("compiler_rt_intercept_libdispatch", @COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL@)
29set_default("compiler_rt_libdir", "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@")
30set_default("emulator", "@COMPILER_RT_EMULATOR@")
31set_default("asan_shadow_scale", "@COMPILER_RT_ASAN_SHADOW_SCALE@")
32set_default("memprof_shadow_scale", "@COMPILER_RT_MEMPROF_SHADOW_SCALE@")
33set_default("apple_platform", "osx")
34set_default("apple_platform_min_deployment_target_flag", "-mmacosx-version-min")
35set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
36set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@)
37set_default("can_symbolize", @CAN_SYMBOLIZE@)
38set_default("use_lld", @COMPILER_RT_TEST_USE_LLD_PYBOOL@)
39set_default("use_thinlto", False)
40set_default("use_lto", config.use_thinlto)
41set_default("use_newpm", False)
42set_default("android", @ANDROID_PYBOOL@)
43set_default("android_api_level", "@ANDROID_API_LEVEL@")
44set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@")
45set_default("android_files_to_push", [])
46set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)
47set_default("gwp_asan", @COMPILER_RT_HAS_GWP_ASAN_PYBOOL@)
48set_default("expensive_checks", @LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL@)
49config.available_features.add('target-is-%s' % config.target_arch)
50
51if config.enable_per_target_runtime_dir:
52  set_default("target_suffix", "")
53elif config.android:
54  if config.target_arch == "i386":
55    set_default("target_suffix", "-i686-android")
56  else:
57    set_default("target_suffix", "-%s-android" % config.target_arch)
58else:
59  set_default("target_suffix", "-%s" % config.target_arch)
60
61set_default("have_zlib", "@LLVM_ENABLE_ZLIB@")
62set_default("libcxx_used", "@LLVM_LIBCXX_USED@")
63
64# LLVM tools dir can be passed in lit parameters, so try to
65# apply substitution.
66try:
67  config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
68  config.clang = config.clang % lit_config.params
69  config.compiler_rt_libdir = config.compiler_rt_libdir % lit_config.params
70except KeyError as e:
71  key, = e.args
72  lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
73
74if not os.path.exists(config.clang):
75  lit_config.fatal("Can't find compiler on path %r" % config.clang)
76
77# Setup attributes common for all compiler-rt projects.
78lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/test/lit.common.cfg.py")
79