summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-07-22 21:35:27 +0000
committerReid Kleckner <reid@kleckner.net>2015-07-22 21:35:27 +0000
commit2f6ad0b719b4f761f7ae8ce41d4ace46131ca8dd (patch)
treef377f939a911a5c2f56ebf785cd2769f8b0c9d3f /llvm/utils
parentf16ec126549420c3906be3b59d07349c46170a1d (diff)
downloadbcm5719-llvm-2f6ad0b719b4f761f7ae8ce41d4ace46131ca8dd.tar.gz
bcm5719-llvm-2f6ad0b719b4f761f7ae8ce41d4ace46131ca8dd.zip
[lit] Fix launching executables relative to the cwd after 'cd'
This was affecting test/asan/TestCases/Windows/coverage-basic.cc in compiler-rt. It does something like: cd %T/mydir %clang %s -o t.exe ./t.exe Previously, we'd end up looking for t.exe relative to the cwd of the lit process, not the cwd of the test. llvm-svn: 242941
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/lit/lit/TestRunner.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index dac06582e14..a4902874325 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -178,7 +178,14 @@ def executeShCmd(cmd, shenv, results):
# Resolve the executable path ourselves.
args = list(j.args)
- executable = lit.util.which(args[0], cmd_shenv.env['PATH'])
+ executable = None
+ # For paths relative to cwd, use the cwd of the shell environment.
+ if args[0].startswith('.'):
+ exe_in_cwd = os.path.join(cmd_shenv.cwd, args[0])
+ if os.path.isfile(exe_in_cwd):
+ executable = exe_in_cwd
+ if not executable:
+ executable = lit.util.which(args[0], cmd_shenv.env['PATH'])
if not executable:
raise InternalShellError(j, '%r: command not found' % j.args[0])
OpenPOWER on IntegriCloud