[Piglit] [PATCH] summary: Rename index.html to all.html and add new index.html

Dylan Baker baker.dylan.c at gmail.com
Fri Jun 7 21:33:20 PDT 2013


This page is a small page giving an overview of the summary results, it
has a count of the number of tests passed, failed, skipped, etc. It
gives a count of how many items are on a given page. The problem is that
with 10,000+ tests, no matter how fast a browser or computer is it will
take a long time to load the current index; further, the all page is so
long that it's often not even useful.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/summary.py  | 50 +++++++++++++++++++++-----------
 templates/index.css   | 79 +++++++++++++--------------------------------------
 templates/index.mako  | 73 ++++++++---------------------------------------
 templates/status.css  | 71 +++++++++++++++++++++++++++++++++++++++++++++
 templates/status.mako | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 214 insertions(+), 138 deletions(-)
 create mode 100644 templates/status.css
 create mode 100644 templates/status.mako

diff --git a/framework/summary.py b/framework/summary.py
index b5ddd95..10f81ab 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -282,7 +282,7 @@ class Result(core.TestrunResult):
                 result = self.parseFile(file)
 
 
-class HTMLIndex(list):
+class HTMLStatus(list):
     """
     Builds HTML output to be passed to the index mako template, which will be
     rendered into HTML pages. It does this by parsing the lists provided by the
@@ -298,7 +298,7 @@ class HTMLIndex(list):
 
         def returnList(open, close):
             """
-            As HTMLIndex iterates through the groups and tests it uses this
+            As HTMLStatus iterates through the groups and tests it uses this
             function to determine which groups to close (and thus reduce the
             depth of the next write) and which ones to open (thus increasing
             the depth)
@@ -700,6 +700,7 @@ class NewSummary:
 
         # Copy static files
         copy("templates/index.css", path.join(destination, "index.css"))
+        copy("templates/status.css", path.join(destination, "status.css"))
         copy("templates/result.css", path.join(destination, "result.css"))
 
         # Create the mako object for creating the test/index.html file
@@ -756,29 +757,44 @@ class NewSummary:
                                                index=index))
                     file.close()
 
-        # Finally build the root html files: index, regressions, etc
+        # A list of pages to be generated
+        pages = ['changes', 'problems', 'skipped', 'fixes', 'regressions']
+
+        # Create the index.html file
         index = Template(filename="templates/index.mako",
                          output_encoding="utf-8",
                          module_directory=".makotmp")
 
-        # A list of pages to be generated
-        pages = ['changes', 'problems', 'skipped', 'fixes', 'regressions']
-
-        # Index.html is a bit of a special case since there is index, all, and
-        # alltests, where the other pages all use the same name. ie,
-        # changes.html, self.changes, and page=changes.
         file = open(path.join(destination, "index.html"), 'w')
-        file.write(index.render(results=HTMLIndex(self, 'alltests'),
-                                page='all',
-                                colnum=len(self.results),
-                                exclude=exclude))
+        file.write(index.render(pages=pages,
+                                counts={'all': len(self.alltests),
+                                        'changes': len(self.changes),
+                                        'problems': len(self.problems),
+                                        'skipped': len(self.problems),
+                                        'fixes': len(self.fixes),
+                                        'regressions': len(self.regressions)}))
+        file.close()
+
+        # Build the root html files: regressions, etc
+        status = Template(filename="templates/status.mako",
+                         output_encoding="utf-8",
+                         module_directory=".makotmp")
+
+        # all.html is a bit of a special case since there is all and alltests,
+        # where the other pages all use the same name. ie, changes.html,
+        # self.changes, and page=changes.
+        file = open(path.join(destination, "all.html"), 'w')
+        file.write(status.render(results=HTMLStatus(self, 'alltests'),
+                                 page='all',
+                                 colnum=len(self.results),
+                                 exclude=exclude))
         file.close()
 
         # Generate the rest of the pages
         for page in pages:
             file = open(path.join(destination, page + '.html'), 'w')
-            file.write(index.render(results=HTMLIndex(self, page),
-                                    page=page,
-                                    colnum=len(self.results),
-                                    exclude=exclude))
+            file.write(status.render(results=HTMLStatus(self, page),
+                                     page=page,
+                                     colnum=len(self.results),
+                                     exclude=exclude))
             file.close()
diff --git a/templates/index.css b/templates/index.css
index 875333f..215d905 100644
--- a/templates/index.css
+++ b/templates/index.css
@@ -1,71 +1,30 @@
-
 table {
-	border: 0pt;
-	border-collapse: collapse;
-	padding-left: 1.75em;
-	padding-right: 1.75em;
-	min-width: 100%;
-	table-layout: fixed;
-}
-
-col:not(:first-child) {
-	width: 70pt;
-}
-
-tr {
-	padding: 4pt;
-}
-
-td {
-	padding: 4pt;
-}
-
-td:first-child {
-	padding: 0;
-}
-
-td:first-child > div {
-	padding: 4pt;
+	margin-left: auto;
+	margin-right: auto;
 }
 
-.title {
-	background-color: #c8c838;
+table td {
+	min-width: 10em;
+	text-align: center;
 }
 
-.head {
-	background-color: #c8c838
+table td:first-child {
+	text-align: left;
+	border-right-style: solid;
+	border-right-color: #000000;
 }
 
-td.skip, td.warn, td.fail, td.pass, td.trap, td.abort, td.crash {
-	text-align: right;
+table tr {
+	font-size: 1.25em;
 }
 
-td.trap, td.abort, td.crash {
+table tr.all {background-color: #ffff95;}
+table tr.changes {background-color: #e1e183;}
+table tr.problems {background-color: #ff9020;}
+table tr.skipped {background-color: #b0b0b0;}
+table tr.fixes {background-color: #20ff20}
+table tr.regressions {
+	background-color: #000000;
+	border-right-color: #ffffff;
 	color: #ffffff;
 }
-
-td.trap a, td.abort a, td.crash a {
-	color: #ffffff;
-}
-
-tr:nth-child(odd)  > td > div.group { background-color: #ffff95 }
-tr:nth-child(even) > td > div.group { background-color: #e1e183 }
-
-tr:nth-child(odd)  td.pass  { background-color: #20ff20; }
-tr:nth-child(even) td.pass  { background-color: #15e015; }
-
-tr:nth-child(odd)  td.skip  { background-color: #b0b0b0; }
-tr:nth-child(even) td.skip  { background-color: #a0a0a0; }
-
-tr:nth-child(odd)  td.warn  { background-color: #ff9020; }
-tr:nth-child(even) td.warn  { background-color: #ef8010; }
-
-tr:nth-child(odd)  td.fail  { background-color: #ff2020; }
-tr:nth-child(even) td.fail  { background-color: #e00505; }
-
-tr:nth-child(odd)  td.trap  { background-color: #111111; }
-tr:nth-child(even) td.trap  { background-color: #000000; }
-tr:nth-child(odd)  td.abort { background-color: #111111; }
-tr:nth-child(even) td.abort { background-color: #000000; }
-tr:nth-child(odd)  td.crash { background-color: #111111; }
-tr:nth-child(even) td.crash { background-color: #000000; }
diff --git a/templates/index.mako b/templates/index.mako
index ea3ec76..6a07dbb 100644
--- a/templates/index.mako
+++ b/templates/index.mako
@@ -4,78 +4,29 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-    <title>Result summary</title>
+    <title>Summary Overview</title>
     <link rel="stylesheet" href="index.css" type="text/css" />
   </head>
   <body>
     <h1>Result summary</h1>
-    <p>Currently showing: ${page}</p>
+    <p>Currently showing: index</p>
     <p>Show:
-      % if page == 'all':
-        all
-      % else:
-        <a href="index.html">all</a>
-      % endif
-      % for i in ['changes', 'fixes', 'problems', 'regressions', 'skipped']:
-        % if i == page:
-          | ${i}
-        % else:
-          | <a href="${i}.html">${i}</a>
-        % endif
+      ## index is seperated out since we don't want a | in front of it
+      index
+      % for i in ['all', 'changes', 'fixes', 'problems', 'regressions', 'skipped']:
+      | <a href="${i}.html">${i}</a>
       % endfor
     </p>
     <table>
       <colgroup>
-        ## Name Column
         <col />
-
-        ## Status columns
-        ## Create an additional column for each summary
-        % for _ in xrange(colnum):
         <col />
-        % endfor
-      </colgroup>
-      % for line in results:
-        % if line['type'] == "newRow":
-        <tr>
-        % elif line['type'] == "endRow":
-        </tr>
-        % elif line['type'] == "groupRow":
-          <td>
-            <div class="${line['class']}" style="margin-left: ${line['indent']}em">
-              <b>${line['text']}</b>
-            </div>
-          </td>
-        % elif line['type'] == "testRow":
-          <td>
-            <div class="${line['class']}" style="margin-left: ${line['indent']}em">
-              ${line['text']}
-            </div>
-          </td>
-        % elif line['type'] == "groupResult":
-          <td class="${line['class']}">
-            <b>${line['text']}</b>
-          </td>
-        % elif line['type'] == "testResult":
-          <td class="${line['class']}">
-          ## If the result is in the excluded results page list from
-          ## argparse, just print the text, otherwise add the link
-          % if line['class'] not in exclude:
-            <a href="${line['href']}">
-              ${line['text']}
-            </a>
-          % else:
-            ${line['text']}
-          % endif
-          </td>
-        % elif line['type'] == "subtestResult":
-          <td class="${line['class']}">
-            ${line['text']}
-          </td>
-        % elif line['type'] == "other":
-          ${line['text']}
-        % endif
+      % for page in ['all', 'changes', 'problems', 'skipped', 'fixes', 'regressions']:
+      <tr class="${page}">
+        <td>${page}</td>
+        <td>${counts[page]}</td>
+      </tr>
       % endfor
-    </table>
+    <table>
   </body>
 </html>
diff --git a/templates/status.css b/templates/status.css
new file mode 100644
index 0000000..875333f
--- /dev/null
+++ b/templates/status.css
@@ -0,0 +1,71 @@
+
+table {
+	border: 0pt;
+	border-collapse: collapse;
+	padding-left: 1.75em;
+	padding-right: 1.75em;
+	min-width: 100%;
+	table-layout: fixed;
+}
+
+col:not(:first-child) {
+	width: 70pt;
+}
+
+tr {
+	padding: 4pt;
+}
+
+td {
+	padding: 4pt;
+}
+
+td:first-child {
+	padding: 0;
+}
+
+td:first-child > div {
+	padding: 4pt;
+}
+
+.title {
+	background-color: #c8c838;
+}
+
+.head {
+	background-color: #c8c838
+}
+
+td.skip, td.warn, td.fail, td.pass, td.trap, td.abort, td.crash {
+	text-align: right;
+}
+
+td.trap, td.abort, td.crash {
+	color: #ffffff;
+}
+
+td.trap a, td.abort a, td.crash a {
+	color: #ffffff;
+}
+
+tr:nth-child(odd)  > td > div.group { background-color: #ffff95 }
+tr:nth-child(even) > td > div.group { background-color: #e1e183 }
+
+tr:nth-child(odd)  td.pass  { background-color: #20ff20; }
+tr:nth-child(even) td.pass  { background-color: #15e015; }
+
+tr:nth-child(odd)  td.skip  { background-color: #b0b0b0; }
+tr:nth-child(even) td.skip  { background-color: #a0a0a0; }
+
+tr:nth-child(odd)  td.warn  { background-color: #ff9020; }
+tr:nth-child(even) td.warn  { background-color: #ef8010; }
+
+tr:nth-child(odd)  td.fail  { background-color: #ff2020; }
+tr:nth-child(even) td.fail  { background-color: #e00505; }
+
+tr:nth-child(odd)  td.trap  { background-color: #111111; }
+tr:nth-child(even) td.trap  { background-color: #000000; }
+tr:nth-child(odd)  td.abort { background-color: #111111; }
+tr:nth-child(even) td.abort { background-color: #000000; }
+tr:nth-child(odd)  td.crash { background-color: #111111; }
+tr:nth-child(even) td.crash { background-color: #000000; }
diff --git a/templates/status.mako b/templates/status.mako
new file mode 100644
index 0000000..8061f1a
--- /dev/null
+++ b/templates/status.mako
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <title>Result summary</title>
+    <link rel="stylesheet" href="status.css" type="text/css" />
+  </head>
+  <body>
+    <h1>Result summary</h1>
+    <p>Currently showing: ${page}</p>
+    <p>Show:
+      ## Index is a logical choice to put first, it will always be a link
+      ## and we don't want in preceeded by a |
+      <a href="index.html">index</a>
+      % for i in ['all', 'changes', 'fixes', 'problems', 'regressions', 'skipped']:
+        % if i == page:
+          | ${i}
+        % else:
+          | <a href="${i}.html">${i}</a>
+        % endif
+      % endfor
+    </p>
+    <table>
+      <colgroup>
+        ## Name Column
+        <col />
+
+        ## Status columns
+        ## Create an additional column for each summary
+        % for _ in xrange(colnum):
+        <col />
+        % endfor
+      </colgroup>
+      % for line in results:
+        % if line['type'] == "newRow":
+        <tr>
+        % elif line['type'] == "endRow":
+        </tr>
+        % elif line['type'] == "groupRow":
+          <td>
+            <div class="${line['class']}" style="margin-left: ${line['indent']}em">
+              <b>${line['text']}</b>
+            </div>
+          </td>
+        % elif line['type'] == "testRow":
+          <td>
+            <div class="${line['class']}" style="margin-left: ${line['indent']}em">
+              ${line['text']}
+            </div>
+          </td>
+        % elif line['type'] == "groupResult":
+          <td class="${line['class']}">
+            <b>${line['text']}</b>
+          </td>
+        % elif line['type'] == "testResult":
+          <td class="${line['class']}">
+          ## If the result is in the excluded results page list from
+          ## argparse, just print the text, otherwise add the link
+          % if line['class'] not in exclude:
+            <a href="${line['href']}">
+              ${line['text']}
+            </a>
+          % else:
+            ${line['text']}
+          % endif
+          </td>
+        % elif line['type'] == "subtestResult":
+          <td class="${line['class']}">
+            ${line['text']}
+          </td>
+        % elif line['type'] == "other":
+          ${line['text']}
+        % endif
+      % endfor
+    </table>
+  </body>
+</html>
-- 
1.8.1.4



More information about the Piglit mailing list