12 from lit
.llvm
import llvm_config
13 from lit
.llvm
.subst
import ToolSubst
14 from lit
.llvm
.subst
import FindTool
16 # Configuration file for the 'lit' test runner.
18 # name: The name of this test suite.
21 # testFormat: The test format to use to interpret tests.
23 # For now we require '&&' between commands, until they get globally killed and
24 # the test runner updated.
25 config
.test_format
= lit
.formats
.ShTest(not llvm_config
.use_lit_shell
)
27 # suffixes: A list of file extensions to treat as test files.
44 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
45 # subdirectories contain auxiliary inputs for various tests in their parent
47 config
.excludes
= ["Inputs", "CMakeLists.txt", "README.txt", "LICENSE.txt"]
49 # test_source_root: The root path where tests are located.
50 config
.test_source_root
= os
.path
.dirname(__file__
)
52 # test_exec_root: The root path where tests should be run.
53 config
.test_exec_root
= os
.path
.join(config
.bolt_obj_root
, "test")
55 # checking if maxIndividualTestTime is available on the platform and sets
56 # it to 60sec if so, declares lit-max-individual-test-time feature for
57 # further checking by tests.
58 supported
, errormsg
= lit_config
.maxIndividualTestTimeIsSupported
60 config
.available_features
.add("lit-max-individual-test-time")
61 lit_config
.maxIndividualTestTime
= 60
64 "Setting a timeout per test not supported. "
66 + " Some tests will be skipped."
69 if config
.bolt_enable_runtime
:
70 config
.available_features
.add("bolt-runtime")
73 config
.available_features
.add("gnu_ld")
75 if lit
.util
.which("fuser"):
76 config
.available_features
.add("fuser")
78 llvm_config
.use_default_substitutions()
80 llvm_config
.config
.environment
["CLANG"] = config
.bolt_clang
81 llvm_config
.use_clang()
83 llvm_config
.config
.environment
["LD_LLD"] = config
.bolt_lld
84 ld_lld
= llvm_config
.use_llvm_tool("ld.lld", required
=True, search_env
="LD_LLD")
85 llvm_config
.config
.available_features
.add("ld.lld")
86 llvm_config
.add_tool_substitutions([ToolSubst(r
"ld\.lld", command
=ld_lld
)])
88 config
.substitutions
.append(("%cflags", ""))
89 config
.substitutions
.append(("%cxxflags", ""))
91 link_fdata_cmd
= os
.path
.join(config
.test_source_root
, "link_fdata.py")
93 tool_dirs
= [config
.llvm_tools_dir
, config
.test_source_root
]
97 if config
.libbolt_rt_instr
:
98 llvm_bolt_args
.append(f
"--runtime-instrumentation-lib={config.libbolt_rt_instr}")
100 if config
.libbolt_rt_hugify
:
101 llvm_bolt_args
.append(f
"--runtime-hugify-lib={config.libbolt_rt_hugify}")
104 ToolSubst("llc", unresolved
="fatal"),
105 ToolSubst("llvm-dwarfdump", unresolved
="fatal"),
109 extra_args
=llvm_bolt_args
,
111 ToolSubst("llvm-boltdiff", unresolved
="fatal"),
112 ToolSubst("llvm-bolt-heatmap", unresolved
="fatal"),
113 ToolSubst("llvm-bat-dump", unresolved
="fatal"),
114 ToolSubst("perf2bolt", unresolved
="fatal"),
115 ToolSubst("yaml2obj", unresolved
="fatal"),
116 ToolSubst("llvm-mc", unresolved
="fatal"),
117 ToolSubst("llvm-nm", unresolved
="fatal"),
118 ToolSubst("llvm-objdump", unresolved
="fatal"),
119 ToolSubst("llvm-objcopy", unresolved
="fatal"),
120 ToolSubst("llvm-strings", unresolved
="fatal"),
121 ToolSubst("llvm-strip", unresolved
="fatal"),
122 ToolSubst("llvm-readelf", unresolved
="fatal"),
125 command
=sys
.executable
,
127 extra_args
=[link_fdata_cmd
],
129 ToolSubst("merge-fdata", unresolved
="fatal"),
130 ToolSubst("llvm-readobj", unresolved
="fatal"),
131 ToolSubst("llvm-dwp", unresolved
="fatal"),
132 ToolSubst("split-file", unresolved
="fatal"),
134 llvm_config
.add_tool_substitutions(tools
, tool_dirs
)
137 def calculate_arch_features(arch_string
):
139 for arch
in arch_string
.split():
140 features
.append(arch
.lower() + "-registered-target")
144 llvm_config
.feature_config(
146 ("--assertion-mode", {"ON": "asserts"}),
147 ("--cxxflags", {r
"-D_GLIBCXX_DEBUG\b": "libstdcxx-safe-mode"}),
148 ("--targets-built", calculate_arch_features
),
152 config
.targets
= frozenset(config
.targets_to_build
.split(";"))