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