aboutsummaryrefslogtreecommitdiffstats
path: root/utils/lit/lit/TestRunner.py
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-26 22:32:58 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-26 22:32:58 +0000
commitc1bb2d432501dabdfcb1e78eccfb7377664c4d14 (patch)
tree42e3584774cbe9c50693b8509b5bd292e644b590 /utils/lit/lit/TestRunner.py
parente7e612f22fb3993b490827bf341196def60d8871 (diff)
downloadexternal_llvm-c1bb2d432501dabdfcb1e78eccfb7377664c4d14.zip
external_llvm-c1bb2d432501dabdfcb1e78eccfb7377664c4d14.tar.gz
external_llvm-c1bb2d432501dabdfcb1e78eccfb7377664c4d14.tar.bz2
Use pipefail when available.
This change makes test with RUN lines like RUN: opt ... | FileCheck fail if opt fails, even if it prints what FileCheck wants. Enabling this found some interesting cases of broken tests that were not being noticed because opt (or some other tool) was crashing late. Pipefail is used when the shell supports it or when using the internal python based tester. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187261 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit/lit/TestRunner.py')
-rw-r--r--utils/lit/lit/TestRunner.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
index 8417699..daa9b7d 100644
--- a/utils/lit/lit/TestRunner.py
+++ b/utils/lit/lit/TestRunner.py
@@ -245,7 +245,8 @@ def executeScriptInternal(test, litConfig, tmpBase, commands, cwd):
cmds = []
for ln in commands:
try:
- cmds.append(ShUtil.ShParser(ln, litConfig.isWindows).parse())
+ cmds.append(ShUtil.ShParser(ln, litConfig.isWindows,
+ test.config.pipefail).parse())
except:
return (Test.FAIL, "shell parser error on: %r" % ln)
@@ -284,6 +285,8 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
if isWin32CMDEXE:
f.write('\nif %ERRORLEVEL% NEQ 0 EXIT\n'.join(commands))
else:
+ if test.config.pipefail:
+ f.write('set -o pipefail;')
f.write('{ ' + '; } &&\n{ '.join(commands) + '; }')
f.write('\n')
f.close()