[llvm-commits] [zorg] r150594 - in /zorg/trunk/lnt/lnt: lnttool/main.py tests/compile.py

Daniel Dunbar daniel at zuster.org
Wed Feb 15 10:01:14 PST 2012


Author: ddunbar
Date: Wed Feb 15 12:01:14 2012
New Revision: 150594

URL: http://llvm.org/viewvc/llvm-project?rev=150594&view=rev
Log:
[lnt] lnt runtest: Add support for --output option for stashing/viewing the
generated report.

Modified:
    zorg/trunk/lnt/lnt/lnttool/main.py
    zorg/trunk/lnt/lnt/tests/compile.py

Modified: zorg/trunk/lnt/lnt/lnttool/main.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/lnttool/main.py?rev=150594&r1=150593&r2=150594&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/main.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/main.py Wed Feb 15 12:01:14 2012
@@ -112,6 +112,9 @@
                       help=("whether the autosubmit result should be committed "
                             "[%default]"),
                       type=int, default=True)
+    parser.add_option("", "--output", dest="output", metavar="PATH",
+                      help="write raw report data to PATH (or stdout if '-')",
+                      action="store", default=None)
     parser.add_option("-v", "--verbose", dest="verbose",
                       help="show verbose test results",
                       action="store_true", default=False)
@@ -130,6 +133,15 @@
 
     report = test_instance.run_test('%s %s' % (name, test_name), args)
 
+    if opts.output is not None:
+        if opts.output == '-':
+            output_stream = sys.stdout
+        else:
+            output_stream = open(opts.output, 'w')
+        print >>output_stream, report.render()
+        if output_stream is not sys.stdout:
+            output_stream.close()
+
     if opts.submit_url is not None:
         if report is None:
             raise SystemExit,"error: report generation failed"

Modified: zorg/trunk/lnt/lnt/tests/compile.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/compile.py?rev=150594&r1=150593&r2=150594&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/tests/compile.py (original)
+++ zorg/trunk/lnt/lnt/tests/compile.py Wed Feb 15 12:01:14 2012
@@ -478,17 +478,13 @@
         parser.add_option("", "--run-order", dest="run_order", metavar="STR",
                           help="String to use to identify and order this run",
                           action="store", type=str, default=None)
-        parser.add_option("", "--tests", dest="tests", metavar="NAME",
+        parser.add_option("", "--test", dest="tests", metavar="NAME",
                           help="Individual test to run",
                           action="append", default=[],
                           choices=[k for k,v in all_tests])
         opts,args = parser.parse_args(args)
 
-        if len(args) == 0:
-            output = '-'
-        elif len(args) == 1:
-            output, = args
-        else:
+        if len(args) != 0:
             parser.error("invalid number of arguments")
 
         # Collect machine and run information.
@@ -602,17 +598,7 @@
         machine = lnt.testing.Machine(opts.machine_name, machine_info)
         run = lnt.testing.Run(start_time, end_time, info = run_info)
 
-        report = lnt.testing.Report(machine, run, testsamples)
-
-        if output == '-':
-            output = sys.stdout
-        else:
-            output = open(output,'w')
-        print >>output, report.render()
-        if output is not sys.stdout:
-            output.close()
-
-        return report
+        return lnt.testing.Report(machine, run, testsamples)
 
 def create_instance():
   return CompileTest()





More information about the llvm-commits mailing list