| 1 |
# -*- Python -*- |
| 2 |
|
| 3 |
# Configuration file for the 'lit' test runner. |
| 4 |
|
| 5 |
import os |
| 6 |
import platform |
| 7 |
import subprocess |
| 8 |
|
| 9 |
import lit.formats |
| 10 |
import lit.util |
| 11 |
|
| 12 |
# name: The name of this test suite. |
| 13 |
config.name = "Clang-Unit" |
| 14 |
|
| 15 |
# suffixes: A list of file extensions to treat as test files. |
| 16 |
config.suffixes = [] |
| 17 |
|
| 18 |
# test_source_root: The root path where tests are located. |
| 19 |
# test_exec_root: The root path where tests should be run. |
| 20 |
config.test_exec_root = os.path.join(config.clang_obj_root, "unittests") |
| 21 |
config.test_source_root = config.test_exec_root |
| 22 |
|
| 23 |
# testFormat: The test format to use to interpret tests. |
| 24 |
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests") |
| 25 |
|
| 26 |
# Propagate the temp directory. Windows requires this because it uses \Windows\ |
| 27 |
# if none of these are present. |
| 28 |
for v in ["TMP", "TEMP", "HOME", "SystemDrive"]: |
| 29 |
if v in os.environ: |
| 30 |
config.environment[v] = os.environ[v] |
| 31 |
|
| 32 |
# Propagate sanitizer options. |
| 33 |
for var in [ |
| 34 |
"ASAN_SYMBOLIZER_PATH", |
| 35 |
"HWASAN_SYMBOLIZER_PATH", |
| 36 |
"MSAN_SYMBOLIZER_PATH", |
| 37 |
"TSAN_SYMBOLIZER_PATH", |
| 38 |
"UBSAN_SYMBOLIZER_PATH", |
| 39 |
"ASAN_OPTIONS", |
| 40 |
"HWASAN_OPTIONS", |
| 41 |
"MSAN_OPTIONS", |
| 42 |
"TSAN_OPTIONS", |
| 43 |
"UBSAN_OPTIONS", |
| 44 |
]: |
| 45 |
if var in os.environ: |
| 46 |
config.environment[var] = os.environ[var] |
| 47 |
|
| 48 |
|
| 49 |
def find_shlibpath_var(): |
| 50 |
if platform.system() in ["Linux", "FreeBSD", "NetBSD", "OpenBSD", "SunOS"]: |
| 51 |
yield "LD_LIBRARY_PATH" |
| 52 |
elif platform.system() == "Darwin": |
| 53 |
yield "DYLD_LIBRARY_PATH" |
| 54 |
elif platform.system() == "Windows" or sys.platform == "cygwin": |
| 55 |
yield "PATH" |
| 56 |
elif platform.system() == "AIX": |
| 57 |
yield "LIBPATH" |
| 58 |
|
| 59 |
|
| 60 |
for shlibpath_var in find_shlibpath_var(): |
| 61 |
# in stand-alone builds, shlibdir is clang's build tree |
| 62 |
# while llvm_libs_dir is installed LLVM (and possibly older clang) |
| 63 |
shlibpath = os.path.pathsep.join( |
| 64 |
( |
| 65 |
config.shlibdir, |
| 66 |
config.llvm_libs_dir, |
| 67 |
config.environment.get(shlibpath_var, ""), |
| 68 |
) |
| 69 |
) |
| 70 |
config.environment[shlibpath_var] = shlibpath |
| 71 |
break |
| 72 |
else: |
| 73 |
lit_config.warning( |
| 74 |
"unable to inject shared library path on '{}'".format(platform.system()) |
| 75 |
) |
| 76 |
|
| 77 |
# It is not realistically possible to account for all options that could |
| 78 |
# possibly be present in system and user configuration files, so disable |
| 79 |
# default configs for the test runs. |
| 80 |
config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1" |