Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Unit / lit.cfg.py
blob475069e630d74e0f50bedff2a6ff0d9c73ad9838
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]
53 def find_shlibpath_var():
54 if platform.system() in ["Linux", "FreeBSD", "NetBSD", "OpenBSD", "SunOS"]:
55 yield "LD_LIBRARY_PATH"
56 elif platform.system() == "Darwin":
57 yield "DYLD_LIBRARY_PATH"
58 elif platform.system() == "Windows":
59 yield "PATH"
60 elif platform.system() == "AIX":
61 yield "LIBPATH"
64 for shlibpath_var in find_shlibpath_var():
65 # in stand-alone builds, shlibdir is clang's build tree
66 # while llvm_libs_dir is installed LLVM (and possibly older clang)
67 shlibpath = os.path.pathsep.join(
69 config.shlibdir,
70 config.llvm_libs_dir,
71 config.environment.get(shlibpath_var, ""),
74 config.environment[shlibpath_var] = shlibpath
75 break
76 else:
77 lit_config.warning(
78 "unable to inject shared library path on '{}'".format(platform.system())
81 # It is not realistically possible to account for all options that could
82 # possibly be present in system and user configuration files, so disable
83 # default configs for the test runs.
84 config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"