[Piglit] [PATCH V3 03/10] templates: adds mako templates for new summary code

Dylan Baker baker.dylan.c at gmail.com
Tue May 28 13:17:48 PDT 2013


Adds the actual templates used to by the new mako based summary code.

V3: Replace tabs with spaces like python code
    Rename test_index.mako to testrun_info.mako
    Refactor testrun_info.mako links bar generation

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/summary.py        |  2 +-
 templates/index.mako        | 75 +++++++++++++++++++++++++++++++++++++++++++++
 templates/test_result.mako  | 47 ++++++++++++++++++++++++++++
 templates/testrun_info.mako | 49 +++++++++++++++++++++++++++++
 4 files changed, 172 insertions(+), 1 deletion(-)
 create mode 100644 templates/index.mako
 create mode 100644 templates/test_result.mako
 create mode 100644 templates/testrun_info.mako

diff --git a/framework/summary.py b/framework/summary.py
index 7c888ee..b25f952 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -712,7 +712,7 @@ class NewSummary:
         copy("templates/result.css", path.join(destination, "result.css"))
 
         # Create the mako object for creating the test/index.html file
-        testindex = Template(filename="templates/test_index.mako",
+        testindex = Template(filename="templates/testrun_info.mako",
                              output_encoding="utf-8",
                              module_directory=".makotmp")
 
diff --git a/templates/index.mako b/templates/index.mako
new file mode 100644
index 0000000..8ca4298
--- /dev/null
+++ b/templates/index.mako
@@ -0,0 +1,75 @@
+<?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="index.css" type="text/css" />
+  </head>
+  <body>
+    <h1>Result summary</h1>
+    <p>Currently showing: all</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
+      % 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']}">
+            <a href="${line['href']}">
+              ${line['text']}
+            </a>
+          </td>
+        % elif line['type'] == "subtestResult":
+          <td class="${line['class']}">
+            ${line['text']}
+          </td>
+        % elif line['type'] == "other":
+          ${line['text']}
+        % endif
+      % endfor
+    </table>
+  </body>
+</html>
diff --git a/templates/test_result.mako b/templates/test_result.mako
new file mode 100644
index 0000000..b4c6921
--- /dev/null
+++ b/templates/test_result.mako
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//END"
+ "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>${testname} - Details</title>
+    <link rel="stylesheet" href="../result.css" type="text/css" />
+  </head>
+  <body>
+    <h1>Results for ${testname}</h1>
+    <h2>Overview</h2>
+    <div>
+      <p><b>Status:</b> ${status}</p>
+      <p><b>Result:</b> ${status}</p>
+    </div>
+    <p><a href="../index.html">Back to summary</a></p>
+    <h2>Details</h2>
+    <table>
+      <tr>
+        <th>Detail</th>
+        <th>Value</th>
+      </tr>
+      <tr>
+        <td>Returncode</td>
+        <td>${returncode}</td>
+      </tr>
+      <tr>
+        <td>Time</td>
+        <td>${time}</b>
+      </tr>
+      <tr>
+        <td>Info</td>
+        <td>
+          <pre>${info}</pre>
+        </td>
+      </tr>
+      <tr>
+        <td>Command</td>
+        <td>
+          </pre>${command}</pre>
+        </td>
+      </tr>
+    </table>
+    <p><a href="../index.html">Back to summary</a></p>
+  </body>
+</html>
diff --git a/templates/testrun_info.mako b/templates/testrun_info.mako
new file mode 100644
index 0000000..e6e00b3
--- /dev/null
+++ b/templates/testrun_info.mako
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//END"
+ "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>${name} - System info</title>
+    <link rel="stylesheet" href="../result.css" type="text/css" />
+  </head>
+  <body>
+    <h1>System info for ${name}</h1>
+    <p>
+      <a href="../index.html">Back to summary</a>
+    </p>
+    <table>
+      <tr>
+        <th>Detail</th>
+        <th>Value</th>
+      </tr>
+      <tr>
+        <td>time_elapsed</td>
+        <td>${time}</td>
+      </tr>
+      <tr>
+        <td>name</td>
+        <td>${name}</td>
+      </tr>
+      <tr>
+        <td>options</td>
+        <td>${options}</td>
+      </tr>
+      <tr>
+        <td>lspci</td>
+        <td>
+          <pre>${lspci}</pre>
+        </td>
+      </tr>
+      <tr>
+        <td>glxinfo</td>
+        <td>
+          <pre>${glxinfo}</pre>
+        </td>
+      </tr>
+    </table>
+    <p>
+      <a href="../index.html">Back to summary</a>
+    </p>
+  </body>
+</html>
-- 
1.8.1.4



More information about the Piglit mailing list