[lld] r313922 - Revert "[lit] Refactor out some more common lit configuration code."
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 21 14:45:45 PDT 2017
Author: zturner
Date: Thu Sep 21 14:45:45 2017
New Revision: 313922
URL: http://llvm.org/viewvc/llvm-project?rev=313922&view=rev
Log:
Revert "[lit] Refactor out some more common lit configuration code."
This is breaking several bots. I have enough information to
investigate, so I'm reverting to green until I get it figured
out.
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=313922&r1=313921&r2=313922&view=diff
==============================================================================
--- lld/trunk/test/lit.cfg.py (original)
+++ lld/trunk/test/lit.cfg.py Thu Sep 21 14:45:45 2017
@@ -10,7 +10,6 @@ import lit.formats
import lit.util
from lit.llvm import llvm_config
-from lit.llvm import ToolFilter
# Configuration file for the 'lit' test runner.
@@ -37,30 +36,58 @@ config.test_source_root = os.path.dirnam
config.test_exec_root = os.path.join(config.lld_obj_root, 'test')
# Tweak the PATH to include the tools dir and the scripts dir.
-llvm_config.with_environment('PATH',
- [config.llvm_tools_dir, config.lld_tools_dir], append_path=True)
+llvm_config.with_environment('PATH', [config.llvm_tools_dir, config.lld_tools_dir], append_path=True)
-llvm_config.with_environment('LD_LIBRARY_PATH',
- [config.lld_libs_dir, config.llvm_libs_dir], append_path=True)
+llvm_config.with_environment('LD_LIBRARY_PATH', [config.lld_libs_dir, config.llvm_libs_dir], append_path=True)
-# 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
+# For each occurrence of a lld 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.
-tool_dirs = [config.lld_tools_dir, config.llvm_tools_dir]
-config.substitutions.append( (r"\bld.lld\b", 'ld.lld --full-shutdown') )
+# Regex assertions to reject neighbor hyphens/dots (seen in some tests).
+# For example, we want to prefix 'lld' and 'ld.lld' but not the 'lld' inside
+# of 'ld.lld'.
+NoPreJunk = r"(?<!(-|\.|/))"
+NoPostJunk = r"(?!(-|\.))"
-tool_patterns = [
- 'FileCheck', 'not', 'ld.lld', 'lld-link', 'llvm-as', 'llvm-mc', 'llvm-nm',
- 'llvm-objdump', 'llvm-pdbutil', 'llvm-readobj', 'obj2yaml', 'yaml2obj',
- ToolFilter('lld', pre='-.', post='-.')]
+config.substitutions.append( (r"\bld.lld\b", 'ld.lld --full-shutdown') )
-llvm_config.add_tool_substitutions(tool_patterns, tool_dirs)
+tool_patterns = [r"\bFileCheck\b",
+ r"\bnot\b",
+ NoPreJunk + r"\blld\b" + NoPostJunk,
+ r"\bld.lld\b",
+ r"\blld-link\b",
+ r"\bllvm-as\b",
+ r"\bllvm-mc\b",
+ r"\bllvm-nm\b",
+ r"\bllvm-objdump\b",
+ r"\bllvm-pdbutil\b",
+ r"\bllvm-readobj\b",
+ r"\bobj2yaml\b",
+ r"\byaml2obj\b"]
+
+for pattern in tool_patterns:
+ # Extract the tool name from the pattern. This relies on the tool
+ # name being surrounded by \b word match operators. If the
+ # pattern starts with "| ", include it in the string to be
+ # substituted.
+ tool_match = re.match(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_\.]+)\\b\W*$",
+ pattern)
+ tool_pipe = tool_match.group(2)
+ tool_name = tool_match.group(4)
+ tool_path = lit.util.which(tool_name, config.environment['PATH'])
+ if not tool_path:
+ # Warn, but still provide a substitution.
+ lit_config.note('Did not find ' + tool_name + ' in ' + path)
+ tool_path = config.llvm_tools_dir + '/' + tool_name
+ config.substitutions.append((pattern, tool_pipe + tool_path))
# 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