blob: a6e906b3a87aa367b6a2a6ad52856bd5f5b5880d [file] [log] [blame]
Jeffrey Yasskinc7da9932011-02-03 04:51:52 +00001# -*- Python -*-
2
3# Configuration file for the 'lit' test runner.
4
5import os
Dmitri Gribenko1bf8d912014-02-18 15:20:02 +00006import platform
David L. Jonesd4053fb2017-07-06 21:46:47 +00007import subprocess
Jeffrey Yasskinc7da9932011-02-03 04:51:52 +00008
Daniel Dunbar94ec6cc2013-08-09 14:43:04 +00009import lit.formats
10import lit.util
11
Jeffrey Yasskinc7da9932011-02-03 04:51:52 +000012# name: The name of this test suite.
13config.name = 'Clang-Unit'
14
15# suffixes: A list of file extensions to treat as test files.
16config.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.
Zachary Turnerce92db12017-09-15 22:10:46 +000020config.test_exec_root = os.path.join(config.clang_obj_root, 'unittests')
21config.test_source_root = config.test_exec_root
Jeffrey Yasskinc7da9932011-02-03 04:51:52 +000022
23# testFormat: The test format to use to interpret tests.
Zachary Turnerce92db12017-09-15 22:10:46 +000024config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')
Jeffrey Yasskinc7da9932011-02-03 04:51:52 +000025
26# Propagate the temp directory. Windows requires this because it uses \Windows\
27# if none of these are present.
28if 'TMP' in os.environ:
29 config.environment['TMP'] = os.environ['TMP']
30if 'TEMP' in os.environ:
31 config.environment['TEMP'] = os.environ['TEMP']
32
Alexey Samsonovc01f4f02013-04-04 07:41:20 +000033# Propagate path to symbolizer for ASan/MSan.
34for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']:
35 if symbolizer in os.environ:
36 config.environment[symbolizer] = os.environ[symbolizer]
37
Tim Shencc5bf002017-10-24 03:11:02 +000038def find_shlibpath_var():
Fedor Sergeev2dfdfa22017-11-27 13:33:19 +000039 if platform.system() in ['Linux', 'FreeBSD', 'NetBSD', 'SunOS']:
Tim Shencc5bf002017-10-24 03:11:02 +000040 yield 'LD_LIBRARY_PATH'
41 elif platform.system() == 'Darwin':
42 yield 'DYLD_LIBRARY_PATH'
43 elif platform.system() == 'Windows':
44 yield 'PATH'
Hubert Tong5dc6a732019-03-29 23:33:04 +000045 elif platform.system() == 'AIX':
46 yield 'LIBPATH'
Dmitri Gribenko1bf8d912014-02-18 15:20:02 +000047
Tim Shencc5bf002017-10-24 03:11:02 +000048for shlibpath_var in find_shlibpath_var():
49 # in stand-alone builds, shlibdir is clang's build tree
50 # while llvm_libs_dir is installed LLVM (and possibly older clang)
51 shlibpath = os.path.pathsep.join(
52 (config.shlibdir,
53 config.llvm_libs_dir,
54 config.environment.get(shlibpath_var, '')))
55 config.environment[shlibpath_var] = shlibpath
56 break
57else:
58 lit_config.warning("unable to inject shared library path on '{}'"
59 .format(platform.system()))