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()
41 'llc', 'llvm-as', 'llvm-mc', 'llvm-nm', 'llvm-objdump', 'llvm-pdbutil',
42 'llvm-dwarfdump', 'llvm-readelf', 'llvm-readobj', 'obj2yaml', 'yaml2obj',
45 llvm_config
.add_tool_substitutions(tool_patterns
)
47 # LLD tests tend to be flaky on NetBSD, so add some retries.
48 # We don't do this on other platforms because it's slower.
49 if platform
.system() in ['NetBSD']:
50 config
.test_retry_attempts
= 2
52 # When running under valgrind, we mangle '-vg' onto the end of the triple so we
53 # can check it with XFAIL and XTARGET.
54 if lit_config
.useValgrind
:
55 config
.target_triple
+= '-vg'
57 # Running on ELF based *nix
58 if platform
.system() in ['FreeBSD', 'NetBSD', 'Linux']:
59 config
.available_features
.add('system-linker-elf')
61 # Set if host-cxxabi's demangler can handle target's symbols.
62 if platform
.system() not in ['Windows']:
63 config
.available_features
.add('demangler')
65 llvm_config
.feature_config(
66 [('--build-mode', {'DEBUG': 'debug'}),
67 ('--assertion-mode', {'ON': 'asserts'}),
68 ('--targets-built', {'AArch64': 'aarch64',
78 'WebAssembly': 'wasm',
82 # Set a fake constant version so that we get consistent output.
83 config
.environment
['LLD_VERSION'] = 'LLD 1.0'
84 config
.environment
['LLD_IN_TEST'] = '1'
86 # Indirectly check if the mt.exe Microsoft utility exists by searching for
87 # cvtres, which always accompanies it. Alternatively, check if we can use
88 # libxml2 to merge manifests.
89 if (lit
.util
.which('cvtres', config
.environment
['PATH']) or
91 config
.available_features
.add('manifest_tool')
93 if config
.have_libxml2
:
94 config
.available_features
.add('libxml2')
96 if config
.have_dia_sdk
:
97 config
.available_features
.add("diasdk")
99 if config
.sizeof_void_p
== 8:
100 config
.available_features
.add("llvm-64-bits")
102 tar_executable
= lit
.util
.which('tar', config
.environment
['PATH'])
104 tar_version
= subprocess
.Popen(
105 [tar_executable
, '--version'],
106 stdout
=subprocess
.PIPE
,
107 stderr
=subprocess
.PIPE
,
109 sout
, _
= tar_version
.communicate()
110 if 'GNU tar' in sout
.decode():
111 config
.available_features
.add('gnutar')
113 # ELF tests expect the default target for ld.lld to be ELF.
114 if config
.ld_lld_default_mingw
:
115 config
.excludes
.append('ELF')