diff options
author | Zachary Turner <zturner@google.com> | 2017-10-06 17:54:46 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-10-06 17:54:46 +0000 |
commit | 96b04b68ed15e596d220449634933815ea09c35c (patch) | |
tree | 1f1434786fcd923bce6814c3a923615e33caf314 /lld/test/lit.cfg.py | |
parent | c981448063c05244d8a44a8d79bbae5031c6114e (diff) | |
download | bcm5719-llvm-96b04b68ed15e596d220449634933815ea09c35c.tar.gz bcm5719-llvm-96b04b68ed15e596d220449634933815ea09c35c.zip |
[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
Diffstat (limited to 'lld/test/lit.cfg.py')
-rw-r--r-- | lld/test/lit.cfg.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lld/test/lit.cfg.py b/lld/test/lit.cfg.py index 017558774a2..a7a0f3af5d6 100644 --- a/lld/test/lit.cfg.py +++ b/lld/test/lit.cfg.py @@ -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: |