changeset 38:ef8590b55605

determine actually correct name extension
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 24 Jul 2012 11:12:07 -0700
parents 0d5cd3dccbec
children ff2f0788e91b
files talosnames/templates/index.html talosnames/web.py
diffstat 2 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/talosnames/templates/index.html	Mon Jul 23 16:09:44 2012 -0700
+++ b/talosnames/templates/index.html	Tue Jul 24 11:12:07 2012 -0700
@@ -27,8 +27,6 @@
 
 .header {
 font-weight: bold;
-align: center;
-text-align: center;
 }
 
 .tbpl_initial {
@@ -117,8 +115,8 @@
   <td class="buildbot">{{suite}}</td>
   <td class="command">{{list2cmdline(commands[suite])}}</tt></td>
   <td class="tbpl">{{tbpl[suite]}}</td>
-  <td class="paint">{{paint.get(suite, '')}}</td>
-  <td class="chrome">{{chrome.get(suite, '')}}</td>
+  <td class="paint"><span title="Paint">{{paint.get(suite, '')}}</span></td>
+  <td class="chrome"><span title="Chrome">{{chrome.get(suite, '')}}</span></td>
   <td class="tests">
     {{if tests.get(suite)}}
     <table>
@@ -130,6 +128,7 @@
       {{for test in sorted(tests[suite].keys())}}
       <tr>
         <td>
+          <i>{{test_type[suite][test]}}</i>
           <div class="header testname">{{test}}</div>
           <dl class="testattributes">
             {{for attr in sorted(tests.get(suite, {})[test].keys())}}
--- a/talosnames/web.py	Mon Jul 23 16:09:44 2012 -0700
+++ b/talosnames/web.py	Tue Jul 24 11:12:07 2012 -0700
@@ -7,6 +7,7 @@
 import optparse
 import os
 import pprint
+import talos.test
 import tempita
 from api import TalosNames
 from subprocess import list2cmdline
@@ -42,6 +43,7 @@
         paint = {}
         chrome = {}
         graphserver = {}
+        test_type = {}
         for suite in suites:
             for test in tests.get(suite) or []:
                 config = self.api.talos_config(suite)
@@ -58,8 +60,20 @@
                 paint[suite] = _paint
                 chrome[suite] = _chrome
 
+                # determine test extension
+                # TODO: move this to api.py
+                testname = test
+                testobj = talos.test.test_dict[testname]
+                if issubclass(testobj, talos.test.TsBase):
+                    test_type.setdefault(suite, {})[test] = 'Startup Test'
+                elif issubclass(testobj, talos.test.PageloaderTest):
+                    test_type.setdefault(suite, {})[test] = 'Page Load Test'
+                    testname += extension
+                else:
+                    raise Exception
+
                 # get graphserver data
-                names = self.api.graphserver_name(test + extension)
+                names = self.api.graphserver_name(testname)
                 if names:
                     graphserver.setdefault(suite, {})[test] = [names]
                 else:
@@ -67,6 +81,7 @@
         self.data['graphserver'] = graphserver
         self.data['paint'] = paint
         self.data['chrome'] = chrome
+        self.data['test_type'] = test_type
 
     def __call__(self, environ, start_response):
         request = Request(environ)
@@ -82,11 +97,22 @@
 if __name__ == '__main__':
 
     parser = optparse.OptionParser()
+    parser.add_option('-o', '--output', dest='output',
+                      help="file to output to")
+    parser.add_option('-p', '--port', dest='port',
+                      default=8080, type='int',
+                      help="port to serve on")
     options, args = parser.parse_args()
 
-    from wsgiref import simple_server
     app = Handler()
-    server = simple_server.make_server(host='0.0.0.0', port=8080, app=app)
-    server.serve_forever()
+
+    if options.output:
+        f = file(options.output, 'w')
+        f.write(app.render())
+        f.close()
+    else:
+        from wsgiref import simple_server
+        server = simple_server.make_server(host='0.0.0.0', port=options.port, app=app)
+        server.serve_forever()