diff options
author | Paul Robinson <paul_robinson@playstation.sony.com> | 2014-03-26 16:40:43 +0000 |
---|---|---|
committer | Paul Robinson <paul_robinson@playstation.sony.com> | 2014-03-26 16:40:43 +0000 |
commit | 5df175cec8ed9ae694fd75ec39c25e9d2eb693f1 (patch) | |
tree | c7c1082e4284347a602911fa6a50d231a8f9b516 /clang | |
parent | 7ac2a3df64649d6244a5de215b7d7e4352929777 (diff) | |
download | bcm5719-llvm-5df175cec8ed9ae694fd75ec39c25e9d2eb693f1.tar.gz bcm5719-llvm-5df175cec8ed9ae694fd75ec39c25e9d2eb693f1.zip |
Recommit r204493 with a fix to look in both clang and llvm directories.
Hopefully addresses r204539.
Make clang/test/lit.cfg pre-scan the RUN line looking for tool names,
and substitute fully qualified path names pointing to the build
directory. This ensures we're testing the just-built tools.
llvm-svn: 204831
Diffstat (limited to 'clang')
-rw-r--r-- | clang/test/lit.cfg | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/clang/test/lit.cfg b/clang/test/lit.cfg index f7acb2f1568..66cec612a3f 100644 --- a/clang/test/lit.cfg +++ b/clang/test/lit.cfg @@ -288,6 +288,42 @@ config.substitutions.append( (' %clang-cl ', """*** invalid substitution, use '%clang_cl'. ***""") ) +# For each occurrence of a clang 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 = os.path.pathsep.join((clang_tools_dir, llvm_tools_dir)) + +# Regex assertions to reject neighbor hyphens/dots (seen in some tests). +# For example, don't match 'clang-check-' or '.clang-format'. +NoPreHyphenDot = r"(?<!(-|\.))" +NoPostHyphenDot = r"(?!(-|\.))" + +for pattern in [r"\bFileCheck\b", + r"\bc-index-test\b", + NoPreHyphenDot + r"\bclang-check\b" + NoPostHyphenDot, + NoPreHyphenDot + r"\bclang-format\b" + NoPostHyphenDot, + # FIXME: Some clang test uses opt? + NoPreHyphenDot + r"\bopt\b" + NoPostHyphenDot, + # Handle these specially as they are strings searched + # for during testing. + r"\| \bcount\b", + r"\| \bnot\b"]: + # 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, tool_dirs) + if not tool_path: + # Warn, but still provide a substitution. + lit_config.note('Did not find ' + tool_name + ' in ' + tool_dirs) + tool_path = clang_tools_dir + '/' + tool_name + config.substitutions.append((pattern, tool_pipe + tool_path)) + ### # Set available features we allow tests to conditionalize on. |