[PATCH] D95339: [RFC][test] Adapt debug-info lit framework for more general purposes - part 1

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 5 07:42:54 PDT 2021


jhenderson added a comment.

TL;DR: I think we can turn off looking for tools on the PATH when use_llvm_tool is used. This covers the use-cases in the debuginfo-tests/cross-project-tests area. Support already exists (but needs improving) for overriding using the just-built tool for these cases.

Full details:

I've dug into how tools are picked up. The exact behaviour depends on the tool in question. The first thing that's important to note is that for most tools, when you see an invocation like `RUN: llvm-objcopy ...`, the "llvm-objcopy" is substituted for the full path to the tool found in build directory. This means the tool won't be found on the PATH. The list of tools is defined in config files, e.g. https://github.com/llvm-mirror/llvm/blob/2c4ca6832fa6b306ee6a7010bfb80a3f2596f824/test/lit.cfg.py#L146.

A limited number of places use `use_llvm_tool` to find the executable. This is used by the debuginfo-tests to find LLDB, clang++, clang-cl and indirectly clang itself. There are various similar uses in other places throughout the project testsuites. `use_llvm_tool` allows you to specify an environment variable which points to the tool to use. In the debuginfo-tests, you can use the environment variable "CLANG" to specify the location of the clang executable. Unfortunately, it also specifies the location of LLDB (I think this is a bug)! If the environment variable is not specified, the tool is found on the PATH. The build directory is at the front of the PATH. This means that if the tool isn't in the build directory (i.e. a user hasn't built it), it will use the installed tool from the PATH.

Given the environment variable option, I think we could just disable using tools from the PATH where use_llvm_tool has been used. Note that we can't completely disable the use of PATH for all cases, because system tools like rm/cp etc need to be available.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95339/new/

https://reviews.llvm.org/D95339



More information about the llvm-commits mailing list