12 from lit
.llvm
import llvm_config
14 # Configuration file for the 'lit' test runner.
16 # name: The name of this test suite.
19 # testFormat: The test format to use to interpret tests.
21 # For now we require '&&' between commands, until they get globally killed and the test runner updated.
22 config
.test_format
= lit
.formats
.ShTest(not llvm_config
.use_lit_shell
)
24 # suffixes: A list of file extensions to treat as test files.
25 config
.suffixes
= [".ll", ".s", ".test", ".yaml", ".objtxt"]
27 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
28 # subdirectories contain auxiliary inputs for various tests in their parent
30 config
.excludes
= ["Inputs"]
32 # test_source_root: The root path where tests are located.
33 config
.test_source_root
= os
.path
.dirname(__file__
)
35 config
.test_exec_root
= os
.path
.join(config
.lld_obj_root
, "test")
37 llvm_config
.use_default_substitutions()
58 llvm_config
.add_tool_substitutions(tool_patterns
)
60 # LLD tests tend to be flaky on NetBSD, so add some retries.
61 # We don't do this on other platforms because it's slower.
62 if platform
.system() in ["NetBSD"]:
63 config
.test_retry_attempts
= 2
65 # When running under valgrind, we mangle '-vg' onto the end of the triple so we
66 # can check it with XFAIL and XTARGET.
67 if lit_config
.useValgrind
:
68 config
.target_triple
+= "-vg"
70 llvm_config
.feature_config(
80 "LoongArch": "loongarch",
86 "WebAssembly": "wasm",
90 ("--assertion-mode", {"ON": "asserts"}),
94 # Set a fake constant version so that we get consistent output.
95 config
.environment
["LLD_VERSION"] = "LLD 1.0"
97 # LLD_IN_TEST determines how many times `main` is run inside each process, which
98 # lets us test that it's cleaning up after itself and resetting global state
99 # correctly (which is important for usage as a library).
100 run_lld_main_twice
= lit_config
.params
.get("RUN_LLD_MAIN_TWICE", False)
101 if not run_lld_main_twice
:
102 config
.environment
["LLD_IN_TEST"] = "1"
104 config
.environment
["LLD_IN_TEST"] = "2"
105 # Many ELF tests fail in this mode.
106 config
.excludes
.append("ELF")
107 # Some old Mach-O backend tests fail, and it's due for removal anyway.
108 config
.excludes
.append("mach-o")
109 # Some new Mach-O backend tests fail; give them a way to mark themselves
110 # unsupported in this mode.
111 config
.available_features
.add("main-run-twice")
113 # Indirectly check if the mt.exe Microsoft utility exists by searching for
114 # cvtres, which always accompanies it. Alternatively, check if we can use
115 # libxml2 to merge manifests.
116 if lit
.util
.which("cvtres", config
.environment
["PATH"]) or config
.have_libxml2
:
117 config
.available_features
.add("manifest_tool")
119 if config
.enable_backtrace
:
120 config
.available_features
.add("backtrace")
122 if config
.have_libxml2
:
123 config
.available_features
.add("libxml2")
125 if config
.have_dia_sdk
:
126 config
.available_features
.add("diasdk")
128 if config
.sizeof_void_p
== 8:
129 config
.available_features
.add("llvm-64-bits")
131 if config
.has_plugins
:
132 config
.available_features
.add("plugins")
134 if config
.build_examples
:
135 config
.available_features
.add("examples")
137 if config
.linked_bye_extension
:
138 config
.substitutions
.append(("%loadbye", ""))
139 config
.substitutions
.append(("%loadnewpmbye", ""))
141 config
.substitutions
.append(
144 "-load={}/Bye{}".format(config
.llvm_shlib_dir
, config
.llvm_shlib_ext
),
147 config
.substitutions
.append(
150 "-load-pass-plugin={}/Bye{}".format(
151 config
.llvm_shlib_dir
, config
.llvm_shlib_ext
156 tar_executable
= lit
.util
.which("tar", config
.environment
["PATH"])
160 tar_version
= subprocess
.Popen(
161 [tar_executable
, "--version"],
162 stdout
=subprocess
.PIPE
,
163 stderr
=subprocess
.PIPE
,
166 sout
, _
= tar_version
.communicate()
167 if "GNU tar" in sout
.decode():
168 config
.available_features
.add("gnutar")
170 # ELF tests expect the default target for ld.lld to be ELF.
171 if config
.ld_lld_default_mingw
:
172 config
.excludes
.append("ELF")