diff --git a/docs/TestingGuide.html b/docs/TestingGuide.html index 1150ac8f962..4d14fe4a8cf 100644 --- a/docs/TestingGuide.html +++ b/docs/TestingGuide.html @@ -376,6 +376,11 @@ clang/test directory.

shell. Consequently the syntax differs from normal shell script syntax in a few ways. You can specify as many RUN lines as needed.

+

lit performs substitution on each RUN line to replace LLVM tool + names with the full paths to the executable built for each tool (in + $(LLVM_OBJ_ROOT)/$(BuildMode)/bin). This ensures that lit does not + invoke any stray LLVM tools in the user's path during testing.

+

Each RUN line is executed on its own, distinct from other lines unless its last character is \. This continuation character causes the RUN line to be concatenated with the next one. In this way you can build up long diff --git a/test/lit.cfg b/test/lit.cfg index 98f72092e31..7df27029bb0 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -4,6 +4,7 @@ import os import sys +import re # name: The name of this test suite. config.name = 'LLVM' @@ -148,6 +149,44 @@ for sub in ['llvmgcc', 'llvmgxx', 'emitir', 'compile_cxx', 'compile_c', else: config.substitutions.append(('%' + sub, site_exp[sub])) +# For each occurrence of an llvm 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. Thus this list +# includes every tool placed in $(LLVM_OBJ_ROOT)/$(BuildMode)/bin +# (llvm_tools_dir in lit parlance). + # Don't match 'bugpoint-'. +for pattern in [r"\bbugpoint\b(?!-)", r"\bclang\b", + r"\bedis\b", r"\bgold\b", + r"\bllc\b", r"\blli\b", + r"\bllvm-ar\b", r"\bllvm-as\b", + r"\bllvm-bcanalyzer\b", r"\bllvm-config\b", + r"\bllvm-diff\b", r"\bllvm-dis\b", + r"\bllvm-extract\b", r"\bllvm-ld\b", + r"\bllvm-link\b", r"\bllvm-mc\b", + r"\bllvm-nm\b", r"\bllvm-prof\b", + r"\bllvm-ranlib\b", r"\bllvm-shlib\b", + r"\bllvm-stub\b", r"\bllvm2cpp\b", + # Don't match '-llvmc'. + r"(?