summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit/TestRunner.py
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-10-24 20:32:49 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-10-24 20:32:49 +0000
commit75a9d64041a0ff3c7b9ea464c8643cb11aab6f4e (patch)
tree9d853c0e516b12e2d05dc0a365111196a8cfb21e /llvm/utils/lit/TestRunner.py
parentd8358b9db650cbaadd2f68cae13491ca26f18517 (diff)
downloadbcm5719-llvm-75a9d64041a0ff3c7b9ea464c8643cb11aab6f4e.tar.gz
bcm5719-llvm-75a9d64041a0ff3c7b9ea464c8643cb11aab6f4e.zip
lit: Support '>>' redirections when executing scripts internally.
llvm-svn: 85014
Diffstat (limited to 'llvm/utils/lit/TestRunner.py')
-rw-r--r--llvm/utils/lit/TestRunner.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/utils/lit/TestRunner.py b/llvm/utils/lit/TestRunner.py
index 34e828bf960..356632e92f3 100644
--- a/llvm/utils/lit/TestRunner.py
+++ b/llvm/utils/lit/TestRunner.py
@@ -63,21 +63,30 @@ def executeShCmd(cmd, cfg, cwd, results):
# output. This is null until we have seen some output using
# stderr.
for i,j in enumerate(cmd.commands):
+ # Apply the redirections, we use (N,) as a sentinal to indicate stdin,
+ # stdout, stderr for N equal to 0, 1, or 2 respectively. Redirects to or
+ # from a file are represented with a list [file, mode, file-object]
+ # where file-object is initially None.
redirects = [(0,), (1,), (2,)]
for r in j.redirects:
if r[0] == ('>',2):
redirects[2] = [r[1], 'w', None]
+ elif r[0] == ('>>',2):
+ redirects[2] = [r[1], 'a', None]
elif r[0] == ('>&',2) and r[1] in '012':
redirects[2] = redirects[int(r[1])]
elif r[0] == ('>&',) or r[0] == ('&>',):
redirects[1] = redirects[2] = [r[1], 'w', None]
elif r[0] == ('>',):
redirects[1] = [r[1], 'w', None]
+ elif r[0] == ('>>',):
+ redirects[1] = [r[1], 'a', None]
elif r[0] == ('<',):
redirects[0] = [r[1], 'r', None]
else:
raise NotImplementedError,"Unsupported redirect: %r" % (r,)
+ # Map from the final redirections to something subprocess can handle.
final_redirects = []
for index,r in enumerate(redirects):
if r == (0,):
OpenPOWER on IntegriCloud