summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-12-10 19:17:35 +0000
committerPete Cooper <peter_cooper@apple.com>2015-12-10 19:17:35 +0000
commit80c9b9468fafec8bdd5e389fc8b3482ace6bbff3 (patch)
tree48d608a95d5804c283f146ecaa2ad20bf7cc85ee
parentccfc3261f39c2dcb1f8b02157fa25c5fb2973bf3 (diff)
downloadbcm5719-llvm-80c9b9468fafec8bdd5e389fc8b3482ace6bbff3.tar.gz
bcm5719-llvm-80c9b9468fafec8bdd5e389fc8b3482ace6bbff3.zip
Make commands printed by llvm-lit include the build path in lit.cfg.
When llvm-lit prints a failure, you'll see something like 'lld *command*' However, you can't then take this, paste it in to a terminal and run it, because it's not got the absolute path of lld. llvm and clang's lit.cfg files contain lists of commands to look for which are substituted by their full paths. So now you'd see something like '*build dir*/bin/lld *command*'. This patch adds the same capability to lld's lit.cfg Reviewed by Rafael EspĂ­ndola llvm-svn: 255283
-rw-r--r--lld/test/lit.cfg40
1 files changed, 40 insertions, 0 deletions
diff --git a/lld/test/lit.cfg b/lld/test/lit.cfg
index 8c0ec51a277..95e4c821400 100644
--- a/lld/test/lit.cfg
+++ b/lld/test/lit.cfg
@@ -139,6 +139,46 @@ if config.test_exec_root is None:
lit_config.load_config(config, site_cfg)
raise SystemExit
+# 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.
+
+# 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'.
+NoPreHyphenDot = r"(?<!(-|\.))"
+NoPostHyphenDot = r"(?!(-|\.))"
+
+tool_patterns = [r"\bFileCheck\b",
+ r"\bnot\b",
+ NoPreHyphenDot + r"\blld\b" + NoPostHyphenDot,
+ r"\bld.lld\b",
+ r"\blld-link\b",
+ r"\bllvm-mc\b",
+ r"\bllvm-nm\b",
+ r"\bllvm-objdump\b",
+ r"\bllvm-readobj\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, llvm_tools_dir)
+ if not tool_path:
+ # Warn, but still provide a substitution.
+ lit_config.note('Did not find ' + tool_name + ' in ' + llvm_tools_dir)
+ tool_path = llvm_tools_dir + '/' + tool_name
+ config.substitutions.append((pattern, tool_pipe + tool_path))
+
+###
+
# 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:
OpenPOWER on IntegriCloud