2012-08-07 16:59:15 +08:00
|
|
|
# -*- Python -*-
|
|
|
|
|
|
|
|
# Configuration file for 'lit' test runner.
|
|
|
|
# This file contains common config setup rules for unit tests in various
|
|
|
|
# compiler-rt testsuites.
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
2013-08-10 06:23:23 +08:00
|
|
|
import lit.formats
|
|
|
|
|
2021-04-23 02:16:21 +08:00
|
|
|
# Copied from libcxx's config.py
|
|
|
|
def get_lit_conf(name, default=None):
|
|
|
|
# Allow overriding on the command line using --param=<name>=<val>
|
|
|
|
val = lit_config.params.get(name, None)
|
|
|
|
if val is None:
|
|
|
|
val = getattr(config, name, None)
|
|
|
|
if val is None:
|
|
|
|
val = default
|
|
|
|
return val
|
|
|
|
|
|
|
|
emulator = get_lit_conf('emulator', None)
|
|
|
|
|
2012-08-07 16:59:15 +08:00
|
|
|
# Setup test format
|
2013-01-30 20:18:49 +08:00
|
|
|
llvm_build_mode = getattr(config, "llvm_build_mode", "Debug")
|
2021-04-23 02:16:21 +08:00
|
|
|
config.test_format = lit.formats.GoogleTest(llvm_build_mode, "Test", emulator)
|
2012-08-07 16:59:15 +08:00
|
|
|
|
|
|
|
# Setup test suffixes.
|
|
|
|
config.suffixes = []
|
|
|
|
|
2013-09-08 21:23:29 +08:00
|
|
|
# Tweak PATH to include llvm tools dir.
|
2017-09-16 06:10:46 +08:00
|
|
|
llvm_tools_dir = config.llvm_tools_dir
|
2013-09-08 21:23:29 +08:00
|
|
|
if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)):
|
|
|
|
lit_config.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir)
|
|
|
|
path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
|
|
|
|
config.environment['PATH'] = path
|
|
|
|
|
2012-08-07 16:59:15 +08:00
|
|
|
# Propagate the temp directory. Windows requires this because it uses \Windows\
|
|
|
|
# if none of these are present.
|
|
|
|
if 'TMP' in os.environ:
|
|
|
|
config.environment['TMP'] = os.environ['TMP']
|
|
|
|
if 'TEMP' in os.environ:
|
|
|
|
config.environment['TEMP'] = os.environ['TEMP']
|
2017-01-20 08:25:01 +08:00
|
|
|
|
|
|
|
if config.host_os == 'Darwin':
|
2019-02-28 03:06:20 +08:00
|
|
|
# Only run up to 3 processes that require shadow memory simultaneously on
|
|
|
|
# 64-bit Darwin. Using more scales badly and hogs the system due to
|
|
|
|
# inefficient handling of large mmap'd regions (terabytes) by the kernel.
|
|
|
|
lit_config.parallelism_groups["shadow-memory"] = 3
|
2021-08-04 07:18:23 +08:00
|
|
|
# Disable libmalloc nanoallocator due to crashes running on macOS 12.0.
|
|
|
|
#
|
|
|
|
# rdar://80086125
|
|
|
|
config.environment['MallocNanoZone'] = '0'
|
2017-01-20 08:25:01 +08:00
|
|
|
|
2017-04-07 09:23:15 +08:00
|
|
|
# The test config gets pickled and sent to multiprocessing workers, and that
|
|
|
|
# only works for code if it is stored at the top level of some module.
|
|
|
|
# Therefore, we have to put the code in a .py file, add it to path, and import
|
|
|
|
# it to store it in the config.
|
2017-04-07 09:24:48 +08:00
|
|
|
import site
|
2017-04-07 09:23:15 +08:00
|
|
|
site.addsitedir(os.path.dirname(__file__))
|
|
|
|
import lit_unittest_cfg_utils
|
|
|
|
config.darwin_sanitizer_parallelism_group_func = \
|
|
|
|
lit_unittest_cfg_utils.darwin_sanitizer_parallelism_group_func
|