blob: 0c6c6b5f1e969bc454a52db31cb0632bb2da8c2c [file] [log] [blame]
Michael J. Spencer773a8fb2011-12-18 08:27:59 +00001# -*- Python -*-
2
3import os
4import platform
5import re
6import subprocess
Michael J. Spencera4f983e2014-03-26 00:53:48 +00007import locale
Michael J. Spencer773a8fb2011-12-18 08:27:59 +00008
Daniel Dunbarbc7bfb12013-08-09 18:51:17 +00009import lit.formats
10import lit.util
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000011
Zachary Turnerd4401d32017-09-18 22:26:48 +000012from lit.llvm import llvm_config
13
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000014# Configuration file for the 'lit' test runner.
15
16# name: The name of this test suite.
17config.name = 'lld'
18
19# testFormat: The test format to use to interpret tests.
20#
21# For now we require '&&' between commands, until they get globally killed and
22# the test runner updated.
Zachary Turnerd4401d32017-09-18 22:26:48 +000023config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000024
25# suffixes: A list of file extensions to treat as test files.
Reid Kleckner892d2a52017-06-26 16:42:44 +000026config.suffixes = ['.ll', '.s', '.test', '.yaml', '.objtxt']
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000027
Rafael Espindolac08ab8e2015-04-24 15:51:45 +000028# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
29# subdirectories contain auxiliary inputs for various tests in their parent
30# directories.
31config.excludes = ['Inputs']
32
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000033# test_source_root: The root path where tests are located.
34config.test_source_root = os.path.dirname(__file__)
35
Zachary Turnerce92db12017-09-15 22:10:46 +000036config.test_exec_root = os.path.join(config.lld_obj_root, 'test')
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000037
Zachary Turner96b04b62017-10-06 17:54:46 +000038llvm_config.use_default_substitutions()
Zachary Turnerad5997e2017-10-12 21:56:05 +000039llvm_config.use_lld()
Pete Cooper80c9b942015-12-10 19:17:35 +000040
Zachary Turner0aa02c02017-09-21 22:16:40 +000041tool_patterns = [
Zachary Turnerad5997e2017-10-12 21:56:05 +000042 'llvm-as', 'llvm-mc', 'llvm-nm',
43 'llvm-objdump', 'llvm-pdbutil', 'llvm-readobj', 'obj2yaml', 'yaml2obj']
Pete Cooper80c9b942015-12-10 19:17:35 +000044
Zachary Turnerad5997e2017-10-12 21:56:05 +000045llvm_config.add_tool_substitutions(tool_patterns)
Pete Cooper80c9b942015-12-10 19:17:35 +000046
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000047# When running under valgrind, we mangle '-vg' onto the end of the triple so we
48# can check it with XFAIL and XTARGET.
Daniel Dunbarbc7bfb12013-08-09 18:51:17 +000049if lit_config.useValgrind:
Michael J. Spencer773a8fb2011-12-18 08:27:59 +000050 config.target_triple += '-vg'
51
Nick Kledzik50bda292014-09-11 00:52:05 +000052# Running on ELF based *nix
Ed Maste933daef2014-09-12 13:16:30 +000053if platform.system() in ['FreeBSD', 'Linux']:
Nick Kledzik50bda292014-09-11 00:52:05 +000054 config.available_features.add('system-linker-elf')
55
NAKAMURA Takumic96ae0c2016-02-09 07:30:11 +000056# Set if host-cxxabi's demangler can handle target's symbols.
57if platform.system() not in ['Windows']:
58 config.available_features.add('demangler')
59
Zachary Turnerd4401d32017-09-18 22:26:48 +000060llvm_config.feature_config(
Zachary Turnerc9814482017-10-06 17:54:27 +000061 [('--build-mode', {'DEBUG': 'debug'}),
62 ('--assertion-mode', {'ON': 'asserts'}),
63 ('--targets-built', {'AArch64': 'aarch64',
64 'AMDGPU': 'amdgpu',
65 'ARM': 'arm',
66 'AVR': 'avr',
67 'Mips': 'mips',
68 'PowerPC': 'ppc',
69 'Sparc': 'sparc',
70 'X86': 'x86'})
71 ])
Rui Ueyamaf23b27a2013-11-04 05:17:54 +000072
Rui Ueyama3da3f062016-11-10 20:20:37 +000073# Set a fake constant version so that we get consitent output.
74config.environment['LLD_VERSION'] = 'LLD 1.0'
75
Eric Beckmannc8dba242017-07-08 03:06:10 +000076# Indirectly check if the mt.exe Microsoft utility exists by searching for
Eric Beckmann87c6acf2017-08-22 03:15:28 +000077# cvtres, which always accompanies it. Alternatively, check if we can use
78# libxml2 to merge manifests.
79if (lit.util.which('cvtres', config.environment['PATH'])) or \
Zachary Turnerc9814482017-10-06 17:54:27 +000080 (config.llvm_libxml2_enabled == '1'):
Eric Beckmann87c6acf2017-08-22 03:15:28 +000081 config.available_features.add('manifest_tool')
Eric Beckmann0aa4b7d2017-09-06 01:50:36 +000082
Zachary Turnerc9814482017-10-06 17:54:27 +000083if (config.llvm_libxml2_enabled == '1'):
Eric Beckmann0aa4b7d2017-09-06 01:50:36 +000084 config.available_features.add('libxml2')
Peter Collingbourne75257bc2017-10-20 19:48:26 +000085
86tar_version = subprocess.Popen(
87 ['tar', '--version'], stdout=subprocess.PIPE, env={'LANG': 'C'})
88if 'GNU tar' in tar_version.stdout.read().decode():
89 config.available_features.add('gnutar')
90tar_version.wait()