From 85e68a66017425d89a8a29dbfac6cdc691b5c659 Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Thu, 26 Oct 2017 02:31:36 +0000 Subject: [PATCH] [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 --- lld/test/lit.cfg.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lld/test/lit.cfg.py b/lld/test/lit.cfg.py index 0c6c6b5..05efee9 100644 --- a/lld/test/lit.cfg.py +++ b/lld/test/lit.cfg.py @@ -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() -- 2.7.4