[llvm-commits] [zorg] r99780 - /zorg/trunk/lnt/examples/functions.py
Daniel Dunbar
daniel at zuster.org
Sun Mar 28 15:08:41 PDT 2010
Author: ddunbar
Date: Sun Mar 28 17:08:40 2010
New Revision: 99780
URL: http://llvm.org/viewvc/llvm-project?rev=99780&view=rev
Log:
LNT: Tweak functions.py to allow output path.
Modified:
zorg/trunk/lnt/examples/functions.py
Modified: zorg/trunk/lnt/examples/functions.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/examples/functions.py?rev=99780&r1=99779&r2=99780&view=diff
==============================================================================
--- zorg/trunk/lnt/examples/functions.py (original)
+++ zorg/trunk/lnt/examples/functions.py Sun Mar 28 17:08:40 2010
@@ -5,12 +5,28 @@
functions, keyed off of the current time.
"""
-import time
+import sys, time
import math, random
from lnt.testing import *
def main():
+ from optparse import OptionParser
+ parser = OptionParser("usage: %prog [options] [output]")
+ opts,args = parser.parse_args()
+
+ if len(args) == 0:
+ output = '-'
+ elif len(args) == 1:
+ output, = args
+ else:
+ parser.error("invalid number of arguments")
+
+ if output == '-':
+ output = sys.stdout
+ else:
+ output = open(output,'w')
+
offset = math.pi/5
delay = 120.
@@ -30,7 +46,10 @@
report = Report(machine, run, tests)
- print report.render()
+ print >>output, report.render()
+
+ if output is not sys.stderr:
+ output.close()
if __name__ == '__main__':
main()
More information about the llvm-commits
mailing list