[llvm-commits] [zorg] r125234 - /zorg/trunk/lnt/lnt/lnttool/__init__.py

Daniel Dunbar daniel at zuster.org
Wed Feb 9 14:55:58 PST 2011


Author: ddunbar
Date: Wed Feb  9 16:55:57 2011
New Revision: 125234

URL: http://llvm.org/viewvc/llvm-project?rev=125234&view=rev
Log:
LNT/runtest: Allow 'lnt runtest' to still generate reports even when a server is
not in use by creating an in memory instance and "submitting" to that.

Modified:
    zorg/trunk/lnt/lnt/lnttool/__init__.py

Modified: zorg/trunk/lnt/lnt/lnttool/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/lnttool/__init__.py?rev=125234&r1=125233&r2=125234&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/__init__.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/__init__.py Wed Feb  9 16:55:57 2011
@@ -132,6 +132,24 @@
         from lnt.util import ServerUtil
         io = StringIO.StringIO(report.render(indent=None))
         ServerUtil.submitFile(opts.submit_url, io, True, opts.verbose)
+    else:
+        # Simulate a submission to retrieve the results report.
+        import lnt.viewer
+        from lnt.util import ImportData
+        import tempfile
+
+        # Save the report to a temporary file.
+        tmp = tempfile.NamedTemporaryFile(suffix='.json')
+        print >>tmp, report.render()
+        tmp.flush()
+
+        # Construct a temporary database and import the result.
+        db = lnt.viewer.PerfDB.PerfDB("sqlite:///:memory:")
+        result = ImportData.import_and_report(
+            None, None, db, tmp.name, 'json', commit = True)
+        ImportData.print_report_result(result, sys.stdout, opts.verbose)
+
+        tmp.close()
 
 def action_showtests(name, args):
     """show the available built-in tests"""





More information about the llvm-commits mailing list