[llvm-commits] [llvm] r159528 - /llvm/trunk/utils/lit/lit/ShUtil.py

Chandler Carruth chandlerc at gmail.com
Mon Jul 2 06:10:15 PDT 2012


Author: chandlerc
Date: Mon Jul  2 08:10:15 2012
New Revision: 159528

URL: http://llvm.org/viewvc/llvm-project?rev=159528&view=rev
Log:
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.

Modified:
    llvm/trunk/utils/lit/lit/ShUtil.py

Modified: llvm/trunk/utils/lit/lit/ShUtil.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/ShUtil.py?rev=159528&r1=159527&r2=159528&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/ShUtil.py (original)
+++ llvm/trunk/utils/lit/lit/ShUtil.py Mon Jul  2 08:10:15 2012
@@ -134,6 +134,8 @@
         if c == '|':
             if self.maybe_eat('|'):
                 return ('||',)
+            if self.maybe_eat('&'):
+                return ('|&',)
             return (c,)
         if c == '&':
             if self.maybe_eat('&'):
@@ -205,7 +207,7 @@
 
             # 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 @@
             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):





More information about the llvm-commits mailing list