[cfe-commits] r77830 - /cfe/trunk/utils/test/TestRunner.py
Daniel Dunbar
daniel at zuster.org
Sat Aug 1 16:18:27 PDT 2009
Author: ddunbar
Date: Sat Aug 1 18:18:27 2009
New Revision: 77830
URL: http://llvm.org/viewvc/llvm-project?rev=77830&view=rev
Log:
lit: Catch (internal) exceptions when using --no-sh.
Modified:
cfe/trunk/utils/test/TestRunner.py
Modified: cfe/trunk/utils/test/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/test/TestRunner.py?rev=77830&r1=77829&r2=77830&view=diff
==============================================================================
--- cfe/trunk/utils/test/TestRunner.py (original)
+++ cfe/trunk/utils/test/TestRunner.py Sat Aug 1 18:18:27 2009
@@ -26,20 +26,13 @@
if isinstance(cmd, ShUtil.Seq):
if cmd.op == ';':
res = executeShCmd(cmd.lhs, cfg, cwd, results)
- if res is None:
- return res
-
return executeShCmd(cmd.rhs, cfg, cwd, results)
if cmd.op == '&':
- Util.warning("unsupported test command: '&'")
- return None
+ raise NotImplementedError,"unsupported test command: '&'"
if cmd.op == '||':
res = executeShCmd(cmd.lhs, cfg, cwd, results)
- if res is None:
- return res
-
if res != 0:
res = executeShCmd(cmd.rhs, cfg, cwd, results)
return res
@@ -72,7 +65,7 @@
elif r[0] == ('<',):
stdin = open(r[1], 'r')
else:
- return None
+ raise NotImplementedError,"Unsupported redirect: %r" % r
procs.append(subprocess.Popen(j.args, cwd=cwd,
stdin = stdin,
@@ -120,9 +113,14 @@
cmd = ShUtil.ShParser(' &&\n'.join(commands)).parse()
results = []
- exitCode = executeShCmd(cmd, cfg, cwd, results)
- if exitCode is None:
- return None
+ try:
+ exitCode = executeShCmd(cmd, cfg, cwd, results)
+ except:
+ import traceback
+
+ out = ''
+ err = 'Exception during script execution:\n%s\n' % traceback.format_exc()
+ return out, err, 127
out = err = ''
for i,(cmd, cmd_out,cmd_err,res) in enumerate(results):
More information about the cfe-commits
mailing list