2011-12-18 16:27:59 +08:00
|
|
|
# -*- Python -*-
|
|
|
|
|
|
|
|
import os
|
|
|
|
import platform
|
|
|
|
import re
|
|
|
|
import subprocess
|
2014-03-26 08:53:48 +08:00
|
|
|
import locale
|
2011-12-18 16:27:59 +08:00
|
|
|
|
2013-08-10 02:51:17 +08:00
|
|
|
import lit.formats
|
|
|
|
import lit.util
|
2011-12-18 16:27:59 +08:00
|
|
|
|
2017-09-19 06:26:48 +08:00
|
|
|
from lit.llvm import llvm_config
|
|
|
|
|
2011-12-18 16:27:59 +08:00
|
|
|
# Configuration file for the 'lit' test runner.
|
|
|
|
|
|
|
|
# name: The name of this test suite.
|
|
|
|
config.name = 'lld'
|
|
|
|
|
|
|
|
# testFormat: The test format to use to interpret tests.
|
|
|
|
#
|
|
|
|
# For now we require '&&' between commands, until they get globally killed and
|
|
|
|
# the test runner updated.
|
2017-09-19 06:26:48 +08:00
|
|
|
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
|
2011-12-18 16:27:59 +08:00
|
|
|
|
|
|
|
# suffixes: A list of file extensions to treat as test files.
|
2017-06-27 00:42:44 +08:00
|
|
|
config.suffixes = ['.ll', '.s', '.test', '.yaml', '.objtxt']
|
2011-12-18 16:27:59 +08:00
|
|
|
|
2015-04-24 23:51:45 +08:00
|
|
|
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
|
|
|
|
# subdirectories contain auxiliary inputs for various tests in their parent
|
|
|
|
# directories.
|
|
|
|
config.excludes = ['Inputs']
|
|
|
|
|
2011-12-18 16:27:59 +08:00
|
|
|
# test_source_root: The root path where tests are located.
|
|
|
|
config.test_source_root = os.path.dirname(__file__)
|
|
|
|
|
2017-09-16 06:10:46 +08:00
|
|
|
config.test_exec_root = os.path.join(config.lld_obj_root, 'test')
|
2011-12-18 16:27:59 +08:00
|
|
|
|
[lit] Improve tool substitution in lit.
This addresses two sources of inconsistency in test configuration
files.
1. Substitution boundaries. Previously you would specify a
substitution, such as 'lli', and then additionally a set
of characters that should fail to match before and after
the tool. This was used, for example, so that matches that
are parts of full paths would not be replaced. But not all
tools did this, and those that did would often re-invent
the set of characters themselves, leading to inconsistency.
Now, every tool substitution defaults to using a sane set
of reasonable defaults and you have to explicitly opt out
of it. This actually fixed a few latent bugs that were
never being surfaced, but only on accident.
2. There was no standard way for the system to decide how to
locate a tool. Sometimes you have an explicit path, sometimes
we would search for it and build up a path ourselves, and
sometimes we would build up a full command line. Furthermore,
there was no standardized way to handle missing tools. Do we
warn, fail, ignore, etc? All of this is now encapsulated in
the ToolSubst class. You either specify an exact command to
run, or an instance of FindTool('<tool-name>') and everything
else just works. Furthermore, you can specify an action to
take if the tool cannot be resolved.
Differential Revision: https://reviews.llvm.org/D38565
llvm-svn: 315085
2017-10-07 01:54:46 +08:00
|
|
|
llvm_config.use_default_substitutions()
|
2017-10-13 05:56:05 +08:00
|
|
|
llvm_config.use_lld()
|
2016-10-27 02:59:00 +08:00
|
|
|
|
2017-09-22 06:16:40 +08:00
|
|
|
tool_patterns = [
|
2017-10-13 05:56:05 +08:00
|
|
|
'llvm-as', 'llvm-mc', 'llvm-nm',
|
|
|
|
'llvm-objdump', 'llvm-pdbutil', 'llvm-readobj', 'obj2yaml', 'yaml2obj']
|
2017-09-22 06:16:40 +08:00
|
|
|
|
2017-10-13 05:56:05 +08:00
|
|
|
llvm_config.add_tool_substitutions(tool_patterns)
|
2015-12-11 03:17:35 +08:00
|
|
|
|
2011-12-18 16:27:59 +08:00
|
|
|
# When running under valgrind, we mangle '-vg' onto the end of the triple so we
|
|
|
|
# can check it with XFAIL and XTARGET.
|
2013-08-10 02:51:17 +08:00
|
|
|
if lit_config.useValgrind:
|
2011-12-18 16:27:59 +08:00
|
|
|
config.target_triple += '-vg'
|
|
|
|
|
2014-09-11 08:52:05 +08:00
|
|
|
# Running on ELF based *nix
|
2014-09-12 21:16:30 +08:00
|
|
|
if platform.system() in ['FreeBSD', 'Linux']:
|
2014-09-11 08:52:05 +08:00
|
|
|
config.available_features.add('system-linker-elf')
|
|
|
|
|
2016-02-09 15:30:11 +08:00
|
|
|
# Set if host-cxxabi's demangler can handle target's symbols.
|
|
|
|
if platform.system() not in ['Windows']:
|
|
|
|
config.available_features.add('demangler')
|
|
|
|
|
2017-09-19 06:26:48 +08:00
|
|
|
llvm_config.feature_config(
|
2017-10-07 01:54:27 +08:00
|
|
|
[('--build-mode', {'DEBUG': 'debug'}),
|
|
|
|
('--assertion-mode', {'ON': 'asserts'}),
|
|
|
|
('--targets-built', {'AArch64': 'aarch64',
|
|
|
|
'AMDGPU': 'amdgpu',
|
|
|
|
'ARM': 'arm',
|
|
|
|
'AVR': 'avr',
|
|
|
|
'Mips': 'mips',
|
|
|
|
'PowerPC': 'ppc',
|
|
|
|
'Sparc': 'sparc',
|
|
|
|
'X86': 'x86'})
|
|
|
|
])
|
2013-11-04 13:17:54 +08:00
|
|
|
|
2016-11-11 04:20:37 +08:00
|
|
|
# Set a fake constant version so that we get consitent output.
|
|
|
|
config.environment['LLD_VERSION'] = 'LLD 1.0'
|
|
|
|
|
2017-07-08 11:06:10 +08:00
|
|
|
# Indirectly check if the mt.exe Microsoft utility exists by searching for
|
2017-08-22 11:15:28 +08:00
|
|
|
# cvtres, which always accompanies it. Alternatively, check if we can use
|
|
|
|
# libxml2 to merge manifests.
|
|
|
|
if (lit.util.which('cvtres', config.environment['PATH'])) or \
|
2017-10-07 01:54:27 +08:00
|
|
|
(config.llvm_libxml2_enabled == '1'):
|
2017-08-22 11:15:28 +08:00
|
|
|
config.available_features.add('manifest_tool')
|
2017-09-06 09:50:36 +08:00
|
|
|
|
2017-10-07 01:54:27 +08:00
|
|
|
if (config.llvm_libxml2_enabled == '1'):
|
2017-09-06 09:50:36 +08:00
|
|
|
config.available_features.add('libxml2')
|
2017-10-21 03:48:26 +08:00
|
|
|
|
2017-10-26 10:31:36 +08:00
|
|
|
tar_executable = lit.util.which('tar', config.environment['PATH'])
|
|
|
|
if tar_executable:
|
|
|
|
tar_version = subprocess.Popen(
|
|
|
|
[tar_executable, '--version'], stdout=subprocess.PIPE, env={'LANG': 'C'})
|
|
|
|
if 'GNU tar' in tar_version.stdout.read().decode():
|
|
|
|
config.available_features.add('gnutar')
|
|
|
|
tar_version.wait()
|