summaryrefslogtreecommitdiffstats
path: root/llvm/test/lit.cfg.py
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/lit.cfg.py')
-rw-r--r--llvm/test/lit.cfg.py119
1 files changed, 52 insertions, 67 deletions
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 26a394f7878..7b935c19558 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -11,7 +11,8 @@ import subprocess
import lit.util
import lit.formats
from lit.llvm import llvm_config
-from lit.llvm import ToolFilter
+from lit.llvm.subst import FindTool
+from lit.llvm.subst import ToolSubst
# name: The name of this test suite.
config.name = 'LLVM'
@@ -82,31 +83,30 @@ def get_asan_rtlib():
return found_dylibs[0]
-lli = 'lli'
+llvm_config.use_default_substitutions()
+
+# Add site-specific substitutions.
+config.substitutions.append(('%llvmshlibdir', config.llvm_shlib_dir))
+config.substitutions.append(('%shlibext', config.llvm_shlib_ext))
+config.substitutions.append(('%exeext', config.llvm_exe_ext))
+config.substitutions.append(('%host_cc', config.host_cc))
+
+
+lli_args = []
# The target triple used by default by lli is the process target triple (some
# triple appropriate for generating code for the current process) but because
# we don't support COFF in MCJIT well enough for the tests, force ELF format on
# Windows. FIXME: the process target triple should be used here, but this is
# difficult to obtain on Windows.
if re.search(r'cygwin|mingw32|windows-gnu|windows-msvc|win32', config.host_triple):
- lli += ' -mtriple=' + config.host_triple + '-elf'
-config.substitutions.append(('%lli', lli))
+ lli_args = ['-mtriple=' + config.host_triple + '-elf']
+
+llc_args = []
# Similarly, have a macro to use llc with DWARF even when the host is win32.
-llc_dwarf = 'llc'
if re.search(r'win32', config.target_triple):
- llc_dwarf += ' -mtriple=' + \
- config.target_triple.replace('-win32', '-mingw32')
-config.substitutions.append(('%llc_dwarf', llc_dwarf))
-
-# Add site-specific substitutions.
-config.substitutions.append(('%gold', config.gold_executable))
-config.substitutions.append(('%go', config.go_executable))
-config.substitutions.append(('%llvmshlibdir', config.llvm_shlib_dir))
-config.substitutions.append(('%shlibext', config.llvm_shlib_ext))
-config.substitutions.append(('%exeext', config.llvm_exe_ext))
-config.substitutions.append(('%python', config.python_executable))
-config.substitutions.append(('%host_cc', config.host_cc))
+ llc_args = [' -mtriple=' +
+ config.target_triple.replace('-win32', '-mingw32')]
# Provide the path to asan runtime lib if available. On darwin, this lib needs
# to be loaded via DYLD_INSERT_LIBRARIES before libLTO.dylib in case the files
@@ -115,36 +115,28 @@ ld64_cmd = config.ld64_executable
asan_rtlib = get_asan_rtlib()
if asan_rtlib:
ld64_cmd = 'DYLD_INSERT_LIBRARIES={} {}'.format(asan_rtlib, ld64_cmd)
-config.substitutions.append(('%ld64', ld64_cmd))
-# OCaml substitutions.
-# Support tests for both native and bytecode builds.
-config.substitutions.append(('%ocamlc',
- '%s ocamlc -cclib -L%s %s' %
- (config.ocamlfind_executable, config.llvm_lib_dir, config.ocaml_flags)))
+ocamlc_command = '%s ocamlc -cclib -L%s %s' % (
+ config.ocamlfind_executable, config.llvm_lib_dir, config.ocaml_flags)
+ocamlopt_command = 'true'
if config.have_ocamlopt:
- config.substitutions.append(('%ocamlopt',
- '%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s' %
- (config.ocamlfind_executable, config.llvm_lib_dir, config.llvm_lib_dir, config.ocaml_flags)))
-else:
- config.substitutions.append(('%ocamlopt', 'true'))
-
-# For each occurrence of an llvm tool name as its own word, replace it
-# with the full path to the build directory holding that tool. This
-# ensures that we are testing the tools just built and not some random
-# tools that might happen to be in the user's PATH. Thus this list
-# includes every tool placed in $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
-# (llvm_tools_dir in lit parlance).
-
-# Avoid matching RUN line fragments that are actually part of
-# path names or options or whatever.
-# The regex is a pre-assertion to avoid matching a preceding
-# dot, hyphen, carat, or slash (.foo, -foo, etc.). Some patterns
-# also have a post-assertion to not match a trailing hyphen (foo-).
-JUNKCHARS = r".-^/<"
-
-required_tools = [
- 'lli', 'llvm-ar', 'llvm-as', 'llvm-bcanalyzer', 'llvm-config', 'llvm-cov',
+ ocamlopt_command = '%s ocamlopt -cclib -L%s -cclib -Wl,-rpath,%s %s' % (
+ config.ocamlfind_executable, config.llvm_lib_dir, config.llvm_lib_dir, config.ocaml_flags)
+
+
+tools = [
+ ToolSubst('%lli', FindTool('lli'), post='.', extra_args=lli_args),
+ ToolSubst('%llc_dwarf', FindTool('llc'), extra_args=llc_args),
+ ToolSubst('%go', config.go_executable, unresolved='ignore'),
+ ToolSubst('%gold', config.gold_executable, unresolved='ignore'),
+ ToolSubst('%ld64', ld64_cmd, unresolved='ignore'),
+ ToolSubst('%ocamlc', ocamlc_command, unresolved='ignore'),
+ ToolSubst('%ocamlopt', ocamlopt_command, unresolved='ignore'),
+]
+
+# FIXME: Why do we have both `lli` and `%lli` that do slightly different things?
+tools.extend([
+ 'lli', 'lli-child-target', 'llvm-ar', 'llvm-as', 'llvm-bcanalyzer', 'llvm-config', 'llvm-cov',
'llvm-cxxdump', 'llvm-cvtres', 'llvm-diff', 'llvm-dis', 'llvm-dsymutil',
'llvm-dwarfdump', 'llvm-extract', 'llvm-isel-fuzzer', 'llvm-lib',
'llvm-link', 'llvm-lto', 'llvm-lto2', 'llvm-mc', 'llvm-mcmarkup',
@@ -152,28 +144,21 @@ required_tools = [
'llvm-pdbutil', 'llvm-profdata', 'llvm-ranlib', 'llvm-readobj',
'llvm-rtdyld', 'llvm-size', 'llvm-split', 'llvm-strings', 'llvm-tblgen',
'llvm-c-test', 'llvm-cxxfilt', 'llvm-xray', 'yaml2obj', 'obj2yaml',
- 'FileCheck', 'yaml-bench', 'verify-uselistorder',
- ToolFilter('bugpoint', post='-'),
- ToolFilter('llc', pre=JUNKCHARS),
- ToolFilter('llvm-symbolizer', pre=JUNKCHARS),
- ToolFilter('opt', JUNKCHARS),
- ToolFilter('sancov', pre=JUNKCHARS),
- ToolFilter('sanstats', pre=JUNKCHARS),
- # Handle these specially as they are strings searched for during testing.
- ToolFilter(r'\| \bcount\b', verbatim=True),
- ToolFilter(r'\| \bnot\b', verbatim=True)]
-
-llvm_config.add_tool_substitutions(required_tools, config.llvm_tools_dir)
-
-# For tools that are optional depending on the config, we won't warn
-# if they're missing.
-
-optional_tools = [
- 'llvm-go', 'llvm-mt', 'Kaleidoscope-Ch3', 'Kaleidoscope-Ch4',
- 'Kaleidoscope-Ch5', 'Kaleidoscope-Ch6', 'Kaleidoscope-Ch7',
- 'Kaleidoscope-Ch8']
-llvm_config.add_tool_substitutions(optional_tools, config.llvm_tools_dir,
- warn_missing=False)
+ 'yaml-bench', 'verify-uselistorder',
+ 'bugpoint', 'llc', 'llvm-symbolizer', 'opt', 'sancov', 'sanstats'])
+
+# The following tools are optional
+tools.extend([
+ ToolSubst('llvm-go', unresolved='ignore'),
+ ToolSubst('llvm-mt', unresolved='ignore'),
+ ToolSubst('Kaleidoscope-Ch3', unresolved='ignore'),
+ ToolSubst('Kaleidoscope-Ch4', unresolved='ignore'),
+ ToolSubst('Kaleidoscope-Ch5', unresolved='ignore'),
+ ToolSubst('Kaleidoscope-Ch6', unresolved='ignore'),
+ ToolSubst('Kaleidoscope-Ch7', unresolved='ignore'),
+ ToolSubst('Kaleidoscope-Ch8', unresolved='ignore')])
+
+llvm_config.add_tool_substitutions(tools, config.llvm_tools_dir)
# Targets
OpenPOWER on IntegriCloud