1# -*- Python -*- 2 3# Configuration file for 'lit' test runner. 4# This file contains common config setup rules for unit tests in various 5# compiler-rt testsuites. 6 7import os 8 9import lit.formats 10 11# Copied from libcxx's config.py 12def get_lit_conf(name, default=None): 13 # Allow overriding on the command line using --param=<name>=<val> 14 val = lit_config.params.get(name, None) 15 if val is None: 16 val = getattr(config, name, None) 17 if val is None: 18 val = default 19 return val 20 21emulator = get_lit_conf('emulator', None) 22 23# Setup test format 24llvm_build_mode = getattr(config, "llvm_build_mode", "Debug") 25config.test_format = lit.formats.GoogleTest(llvm_build_mode, "Test", emulator) 26 27# Setup test suffixes. 28config.suffixes = [] 29 30# Tweak PATH to include llvm tools dir. 31llvm_tools_dir = config.llvm_tools_dir 32if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)): 33 lit_config.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir) 34path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) 35config.environment['PATH'] = path 36 37# Propagate the temp directory. Windows requires this because it uses \Windows\ 38# if none of these are present. 39if 'TMP' in os.environ: 40 config.environment['TMP'] = os.environ['TMP'] 41if 'TEMP' in os.environ: 42 config.environment['TEMP'] = os.environ['TEMP'] 43 44if config.host_os == 'Darwin': 45 # Only run up to 3 processes that require shadow memory simultaneously on 46 # 64-bit Darwin. Using more scales badly and hogs the system due to 47 # inefficient handling of large mmap'd regions (terabytes) by the kernel. 48 lit_config.parallelism_groups["shadow-memory"] = 3 49 50 # The test config gets pickled and sent to multiprocessing workers, and that 51 # only works for code if it is stored at the top level of some module. 52 # Therefore, we have to put the code in a .py file, add it to path, and import 53 # it to store it in the config. 54 import site 55 site.addsitedir(os.path.dirname(__file__)) 56 import lit_unittest_cfg_utils 57 config.darwin_sanitizer_parallelism_group_func = \ 58 lit_unittest_cfg_utils.darwin_sanitizer_parallelism_group_func 59