diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-26 22:32:58 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-26 22:32:58 +0000 |
| commit | 2a2a0973b8d67817c30a0105b7a09f87ec3b4fd1 (patch) | |
| tree | 132fb2aede44ab050147f3664fcd8009548d34a5 /llvm/utils/lit | |
| parent | f9709e753ffefe931b080bcc6ef5e9217e5520e5 (diff) | |
| download | bcm5719-llvm-2a2a0973b8d67817c30a0105b7a09f87ec3b4fd1.tar.gz bcm5719-llvm-2a2a0973b8d67817c30a0105b7a09f87ec3b4fd1.zip | |
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.
llvm-svn: 187261
Diffstat (limited to 'llvm/utils/lit')
| -rw-r--r-- | llvm/utils/lit/lit/ShUtil.py | 5 | ||||
| -rw-r--r-- | llvm/utils/lit/lit/TestRunner.py | 5 | ||||
| -rw-r--r-- | llvm/utils/lit/lit/TestingConfig.py | 1 |
3 files changed, 8 insertions, 3 deletions
diff --git a/llvm/utils/lit/lit/ShUtil.py b/llvm/utils/lit/lit/ShUtil.py index 50f79103199..00bb40255c9 100644 --- a/llvm/utils/lit/lit/ShUtil.py +++ b/llvm/utils/lit/lit/ShUtil.py @@ -166,8 +166,9 @@ class ShLexer: ### class ShParser: - def __init__(self, data, win32Escapes = False): + def __init__(self, data, win32Escapes = False, pipefail = False): self.data = data + self.pipefail = pipefail self.tokens = ShLexer(data, win32Escapes = win32Escapes).lex() def lex(self): @@ -224,7 +225,7 @@ class ShParser: while self.look() == ('|',): self.lex() commands.append(self.parse_command()) - return Pipeline(commands, negate) + return Pipeline(commands, negate, self.pipefail) def parse(self): lhs = self.parse_pipeline() diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index 84176996a8c..daa9b7dfbb0 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/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() diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py index a1f79a3bfc4..5d5832e9bb6 100644 --- a/llvm/utils/lit/lit/TestingConfig.py +++ b/llvm/utils/lit/lit/TestingConfig.py @@ -92,6 +92,7 @@ class TestingConfig: self.test_source_root = test_source_root self.excludes = set(excludes) self.available_features = set(available_features) + self.pipefail = True def clone(self, path): # FIXME: Chain implementations? |

