llvm-project
89 строк · 4.4 Кб
1@LIT_SITE_CFG_IN_HEADER@
2
3# Set attribute value if it is unset.
4def set_default(attr, value):
5if not getattr(config, attr, None):
6setattr(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("lit_tools_dir", "@LLVM_LIT_TOOLS_DIR@")
22set_default("llvm_shlib_dir", "@LLVM_LIBRARY_OUTPUT_INTDIR@")
23set_default("gnu_ld_executable", "@GNU_LD_EXECUTABLE@")
24set_default("gold_executable", "@GOLD_EXECUTABLE@")
25set_default("clang", "@COMPILER_RT_RESOLVED_TEST_COMPILER@")
26set_default("compiler_id", "@COMPILER_RT_TEST_COMPILER_ID@")
27set_default("python_executable", "@Python3_EXECUTABLE@")
28set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
29set_default("compiler_rt_intercept_libdispatch", @COMPILER_RT_INTERCEPT_LIBDISPATCH_PYBOOL@)
30set_default("compiler_rt_output_dir", "@COMPILER_RT_RESOLVED_OUTPUT_DIR@")
31set_default("compiler_rt_libdir", "@COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR@")
32set_default("emulator", "@COMPILER_RT_EMULATOR@")
33set_default("asan_shadow_scale", "@COMPILER_RT_ASAN_SHADOW_SCALE@")
34set_default("memprof_shadow_scale", "@COMPILER_RT_MEMPROF_SHADOW_SCALE@")
35set_default("apple_platform", "osx")
36set_default("apple_platform_min_deployment_target_flag", "-mmacosx-version-min")
37set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
38set_default("sanitizer_uses_static_cxxabi", @SANITIZER_USE_STATIC_CXX_ABI_PYBOOL@)
39set_default("sanitizer_uses_static_unwind", @SANITIZER_USE_STATIC_LLVM_UNWINDER_PYBOOL@)
40set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@)
41set_default("can_symbolize", @CAN_SYMBOLIZE@)
42set_default("use_lld", @COMPILER_RT_TEST_USE_LLD_PYBOOL@)
43set_default("use_thinlto", False)
44set_default("use_lto", config.use_thinlto)
45set_default("android", @ANDROID_PYBOOL@)
46set_default("android_api_level", "@ANDROID_API_LEVEL@")
47set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@")
48set_default("android_files_to_push", [])
49set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)
50set_default("gwp_asan", @COMPILER_RT_HAS_GWP_ASAN_PYBOOL@)
51set_default("expensive_checks", @LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL@)
52set_default("test_standalone_build_libs", @COMPILER_RT_TEST_STANDALONE_BUILD_LIBS_PYBOOL@)
53set_default("has_compiler_rt_libatomic", @COMPILER_RT_BUILD_STANDALONE_LIBATOMIC_PYBOOL@)
54set_default("aarch64_sme", @COMPILER_RT_HAS_AARCH64_SME_PYBOOL@)
55set_default("darwin_linker_version", "@COMPILER_RT_DARWIN_LINKER_VERSION@")
56# True iff the test suite supports ignoring the test compiler's runtime library path
57# and using `config.compiler_rt_libdir` instead. This only matters when the runtime
58# library paths differ.
59set_default("test_suite_supports_overriding_runtime_lib_path", False)
60config.available_features.add('target-is-%s' % config.target_arch)
61
62if config.enable_per_target_runtime_dir:
63set_default("target_suffix", "")
64elif config.android:
65if config.target_arch == "i386":
66set_default("target_suffix", "-i686-android")
67else:
68set_default("target_suffix", "-%s-android" % config.target_arch)
69else:
70set_default("target_suffix", "-%s" % config.target_arch)
71
72set_default("have_internal_symbolizer", @COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER_PYBOOL@)
73set_default("have_zlib", @ZLIB_FOUND_PYBOOL@)
74set_default("libcxx_used", "@LLVM_LIBCXX_USED@")
75
76# LLVM tools dir can be passed in lit parameters, so try to
77# apply substitution.
78config.llvm_tools_dir = lit_config.substitute(config.llvm_tools_dir)
79config.clang = lit_config.substitute(config.clang)
80config.compiler_rt_libdir = lit_config.substitute(config.compiler_rt_libdir)
81
82if not os.path.exists(config.clang):
83lit_config.fatal("Can't find compiler on path %r" % config.clang)
84
85import lit.llvm
86lit.llvm.initialize(lit_config, config)
87
88# Setup attributes common for all compiler-rt projects.
89lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/test/lit.common.cfg.py")
90