From: Reid Kleckner Date: Wed, 22 Jul 2015 21:35:27 +0000 (+0000) Subject: [lit] Fix launching executables relative to the cwd after 'cd' X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bc6cbbfa80c26a1081c4a62fe4e98dd241486593;p=oota-llvm.git [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242941 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py index dac06582e14..a4902874325 100644 --- a/utils/lit/lit/TestRunner.py +++ b/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])