summaryrefslogtreecommitdiff
path: root/utils/lit
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-22 04:44:26 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-22 04:44:26 +0000
commit6bd2b2e9a27df118951d2fdc88df249d56a4d8fe (patch)
tree0bd24a7ec3cf6a31c6e834ee55d531be20aa79f2 /utils/lit
parent27dba671c3f158a33c8cbdf5196a6fd16489be03 (diff)
downloadllvm-6bd2b2e9a27df118951d2fdc88df249d56a4d8fe.tar.gz
llvm-6bd2b2e9a27df118951d2fdc88df249d56a4d8fe.tar.bz2
llvm-6bd2b2e9a27df118951d2fdc88df249d56a4d8fe.tar.xz
lit: When executing commands internally, perform PATH resolution ourselves.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rw-r--r--utils/lit/TestRunner.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/utils/lit/TestRunner.py b/utils/lit/TestRunner.py
index 6ed3ce609e..5fadfd5f17 100644
--- a/utils/lit/TestRunner.py
+++ b/utils/lit/TestRunner.py
@@ -5,6 +5,11 @@ import ShUtil
import Test
import Util
+class InternalShellError(Exception):
+ def __init__(self, command, message):
+ self.command = command
+ self.message = message
+
def executeCommand(command, cwd=None, env=None):
p = subprocess.Popen(command, cwd=cwd,
stdin=subprocess.PIPE,
@@ -94,6 +99,13 @@ def executeShCmd(cmd, cfg, cwd, results):
stderrIsStdout = True
else:
stderrIsStdout = False
+
+ # Resolve the executable path ourselves.
+ args = list(j.args)
+ args[0] = Util.which(args[0], cfg.environment['PATH'])
+ if not args[0]:
+ raise InternalShellError(j, '%r: command not found' % j.args[0])
+
procs.append(subprocess.Popen(j.args, cwd=cwd,
stdin = stdin,
stdout = stdout,
@@ -159,7 +171,12 @@ def executeScriptInternal(test, litConfig, tmpBase, commands, cwd):
return (Test.FAIL, "shell parser error on: %r" % ln)
results = []
- exitCode = executeShCmd(cmd, test.config, cwd, results)
+ try:
+ exitCode = executeShCmd(cmd, test.config, cwd, results)
+ except InternalShellError,e:
+ out = ''
+ err = e.message
+ exitCode = 255
out = err = ''
for i,(cmd, cmd_out,cmd_err,res) in enumerate(results):
@@ -225,7 +242,11 @@ def executeTclScriptInternal(test, litConfig, tmpBase, commands, cwd):
return out,err,exitCode
else:
results = []
- exitCode = executeShCmd(cmd, test.config, cwd, results)
+ try:
+ exitCode = executeShCmd(cmd, test.config, cwd, results)
+ except InternalShellError,e:
+ results.append((e.command, '', e.message + '\n', 255))
+ exitCode = 255
out = err = ''