[lld] r315085 - [lit] Improve tool substitution in lit.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 10:54:46 PDT 2017
Author: zturner
Date: Fri Oct 6 10:54:46 2017
New Revision: 315085
URL: http://llvm.org/viewvc/llvm-project?rev=315085&view=rev
Log:
[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
Modified:
lld/trunk/test/lit.cfg.py
Modified: lld/trunk/test/lit.cfg.py
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/lit.cfg.py?rev=315085&r1=315084&r2=315085&view=diff
==============================================================================
--- lld/trunk/test/lit.cfg.py (original)
+++ lld/trunk/test/lit.cfg.py Fri Oct 6 10:54:46 2017
@@ -10,7 +10,7 @@ import lit.formats
import lit.util
from lit.llvm import llvm_config
-from lit.llvm import ToolFilter
+from lit.llvm.subst import ToolSubst
# Configuration file for the 'lit' test runner.
@@ -43,24 +43,22 @@ llvm_config.with_environment('PATH',
llvm_config.with_environment('LD_LIBRARY_PATH',
[config.lld_libs_dir, config.llvm_libs_dir], append_path=True)
+llvm_config.use_default_substitutions()
+
# For each occurrence of a clang tool name, replace it with the full path to
# the build directory holding that tool. We explicitly specify the directories
# to search to ensure that we get the tools just built and not some random
# tools that might happen to be in the user's PATH.
tool_dirs = [config.lld_tools_dir, config.llvm_tools_dir]
-config.substitutions.append((r"\bld.lld\b", 'ld.lld --full-shutdown'))
-
tool_patterns = [
- 'FileCheck', 'not', 'ld.lld', 'lld-link', 'llvm-as', 'llvm-mc', 'llvm-nm',
+ ToolSubst('ld.lld', extra_args=['--full-shutdown']),
+ 'lld-link', 'llvm-as', 'llvm-mc', 'llvm-nm',
'llvm-objdump', 'llvm-pdbutil', 'llvm-readobj', 'obj2yaml', 'yaml2obj',
- ToolFilter('lld', pre='-./', post='-.')]
+ 'lld']
llvm_config.add_tool_substitutions(tool_patterns, tool_dirs)
-# Add site-specific substitutions.
-config.substitutions.append(('%python', config.python_executable))
-
# When running under valgrind, we mangle '-vg' onto the end of the triple so we
# can check it with XFAIL and XTARGET.
if lit_config.useValgrind:
More information about the llvm-commits
mailing list