summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2013-01-31 20:51:17 +0000
committerDaniel Dunbar <daniel@zuster.org>2013-01-31 20:51:17 +0000
commit281e4b1f92c7b3ba39e58094a0c2c2cd3438980e (patch)
tree0f582d80f1f2983948295013e8832821897da774 /llvm/utils/lit
parentc6d39314b2c3785fdc0056ee52ac992a3cdfac75 (diff)
downloadbcm5719-llvm-281e4b1f92c7b3ba39e58094a0c2c2cd3438980e.tar.gz
bcm5719-llvm-281e4b1f92c7b3ba39e58094a0c2c2cd3438980e.zip
[lit] Fix a shell parsing bug with ';' not separated by whitespace.
- Testing finds bugs, who knew. llvm-svn: 174087
Diffstat (limited to 'llvm/utils/lit')
-rw-r--r--llvm/utils/lit/lit/ShUtil.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/utils/lit/lit/ShUtil.py b/llvm/utils/lit/lit/ShUtil.py
index 5d65dc0d3d9..50f79103199 100644
--- a/llvm/utils/lit/lit/ShUtil.py
+++ b/llvm/utils/lit/lit/ShUtil.py
@@ -35,7 +35,7 @@ class ShLexer:
if ('|' in chunk or '&' in chunk or
'<' in chunk or '>' in chunk or
"'" in chunk or '"' in chunk or
- '\\' in chunk):
+ ';' in chunk or '\\' in chunk):
return None
self.pos = self.pos - 1 + len(chunk)
@@ -48,7 +48,7 @@ class ShLexer:
str = c
while self.pos != self.end:
c = self.look()
- if c.isspace() or c in "|&":
+ if c.isspace() or c in "|&;":
break
elif c in '><':
# This is an annoying case; we treat '2>' as a single token so
@@ -250,9 +250,9 @@ class TestShLexer(unittest.TestCase):
return list(ShLexer(str, *args, **kwargs).lex())
def test_basic(self):
- self.assertEqual(self.lex('a|b>c&d<e'),
+ self.assertEqual(self.lex('a|b>c&d<e;f'),
['a', ('|',), 'b', ('>',), 'c', ('&',), 'd',
- ('<',), 'e'])
+ ('<',), 'e', (';',), 'f'])
def test_redirection_tokens(self):
self.assertEqual(self.lex('a2>c'),
@@ -342,5 +342,10 @@ class TestShParse(unittest.TestCase):
'||',
Pipeline([Command(['c'], [])], False)))
+ self.assertEqual(self.parse('a; b'),
+ Seq(Pipeline([Command(['a'], [])], False),
+ ';',
+ Pipeline([Command(['b'], [])], False)))
+
if __name__ == '__main__':
unittest.main()
OpenPOWER on IntegriCloud