[lit] Respect LLVM_LIT_TOOLS_DIR when looking for 'tar' on Windows.

Changes in D38977 expect 'tar' to be found in one of PATH directories.
On Windows, one might opt to use LLVM_LIT_TOOLS_DIR rather than add MSYS
tools directory to the PATH. In that case, tests for lld failed on run.

Differential Revision: https://reviews.llvm.org/D39278

llvm-svn: 316635
This commit is contained in:
Igor Kudrin 2017-10-26 02:31:36 +00:00
parent 5c2aecef78
commit 85e68a6601
1 changed files with 7 additions and 5 deletions

View File

@ -83,8 +83,10 @@ if (lit.util.which('cvtres', config.environment['PATH'])) or \
if (config.llvm_libxml2_enabled == '1'):
config.available_features.add('libxml2')
tar_version = subprocess.Popen(
['tar', '--version'], stdout=subprocess.PIPE, env={'LANG': 'C'})
if 'GNU tar' in tar_version.stdout.read().decode():
config.available_features.add('gnutar')
tar_version.wait()
tar_executable = lit.util.which('tar', config.environment['PATH'])
if tar_executable:
tar_version = subprocess.Popen(
[tar_executable, '--version'], stdout=subprocess.PIPE, env={'LANG': 'C'})
if 'GNU tar' in tar_version.stdout.read().decode():
config.available_features.add('gnutar')
tar_version.wait()