forked from OSchip/llvm-project
[lit] Report tool path from use_llvm_tool if found via env variable
Previously, if the search_env argument was specified, and the tool was found at that location, the path was not reported, unlike other situations when this function was called. Adding the reporting makes the function consistent. Reviewed by: thopre Differential Revision: https://reviews.llvm.org/D101896
This commit is contained in:
parent
ab5932ffbd
commit
abe2c906ad
|
@ -407,11 +407,11 @@ class LLVMConfig(object):
|
|||
configuration's PATH."""
|
||||
# If the override is specified in the environment, use it without
|
||||
# validation.
|
||||
tool = None
|
||||
if search_env:
|
||||
tool = self.config.environment.get(search_env)
|
||||
if tool:
|
||||
return tool
|
||||
|
||||
if not tool:
|
||||
# Otherwise look in the path.
|
||||
tool = lit.util.which(name, self.config.environment['PATH'])
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import lit.formats
|
||||
config.name = 'search-env'
|
||||
config.suffixes = ['.txt']
|
||||
config.test_format = lit.formats.ShTest()
|
||||
config.test_source_root = None
|
||||
config.test_exec_root = None
|
||||
import lit.llvm
|
||||
lit.llvm.initialize(lit_config, config)
|
||||
import os.path
|
||||
lit.llvm.llvm_config.with_environment('TOOL_LOCATION', os.path.dirname(__file__) + '/test.tool')
|
||||
lit.llvm.llvm_config.use_llvm_tool('test-tool', search_env='TOOL_LOCATION')
|
|
@ -0,0 +1 @@
|
|||
# RUN: true
|
|
@ -0,0 +1,7 @@
|
|||
## Show that lit reports the path to tools picked up via the use_llvm_tool
|
||||
## function when the tool is found via an environment variable.
|
||||
|
||||
# RUN: %{lit} %{inputs}/use-tool-search-env 2>&1 | \
|
||||
# RUN: FileCheck %s -DDIR=%p
|
||||
|
||||
# CHECK: note: using test-tool: [[DIR]]{{[\\/]}}Inputs{{[\\/]}}use-tool-search-env{{[\\/]}}test.tool
|
Loading…
Reference in New Issue