diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-07-02 13:10:15 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-07-02 13:10:15 +0000 |
commit | cab8e1ed55772df9faece067795f2e1e78e565b0 (patch) | |
tree | 289497ab7a3faecf76d2a164ee188f443679a6e8 /utils/lit | |
parent | b2833d9dcba88c6f0520cad760619200adc0442c (diff) | |
download | external_llvm-cab8e1ed55772df9faece067795f2e1e78e565b0.zip external_llvm-cab8e1ed55772df9faece067795f2e1e78e565b0.tar.gz external_llvm-cab8e1ed55772df9faece067795f2e1e78e565b0.tar.bz2 |
Teach the built-in shell test runner in lit to handle '|&'-style pipes.
This is directly cloned from the logic in the TCL test bits of lit.
Hopefully will fix most of the windows build bot fallout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159528 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rw-r--r-- | utils/lit/lit/ShUtil.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/utils/lit/lit/ShUtil.py b/utils/lit/lit/ShUtil.py index dda622a..0c5bdac 100644 --- a/utils/lit/lit/ShUtil.py +++ b/utils/lit/lit/ShUtil.py @@ -134,6 +134,8 @@ class ShLexer: if c == '|': if self.maybe_eat('|'): return ('||',) + if self.maybe_eat('&'): + return ('|&',) return (c,) if c == '&': if self.maybe_eat('&'): @@ -205,7 +207,7 @@ class ShParser: # Otherwise see if it is a terminator. assert isinstance(tok, tuple) - if tok[0] in ('|',';','&','||','&&'): + if tok[0] in ('|','|&',';','&','||','&&'): break # Otherwise it must be a redirection. @@ -224,9 +226,18 @@ class ShParser: negate = True commands = [self.parse_command()] - while self.look() == ('|',): - self.lex() - commands.append(self.parse_command()) + while 1: + tok = self.look() + if tok == ('|',): + self.lex() + commands.append(self.parse_command()) + continue + if tok == ('|&',): + self.lex() + commands[-1].redirects.insert(0, (('>&',2),'1')) + commands.append(self.parse_command()) + continue + break return Pipeline(commands, negate) def parse(self): |