[Piglit] [PATCH v2 03/11] templates: adds mako templates for new summary code

Dylan Baker baker.dylan.c at gmail.com
Sat May 25 02:46:51 PDT 2013


Cool, I can make those changes.

As a side note, mako indents are wysiwyg, so there is a balancing act
between getting an easy to read template and an easy to read output.


On Sat, May 25, 2013 at 2:34 AM, Kenneth Graunke <kenneth at whitecape.org>wrote:

> On 05/17/2013 09:31 AM, Dylan Baker wrote:
>
>> Adds the actual templates used to by the new mako based summary code.
>>
>> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
>>
>
> It would be great to use spaces in this (rather than tabs) for
> consistency.  The embedded Python code already uses spaces.
>
>
>  ---
>>   templates/index.mako       | 79 ++++++++++++++++++++++++++++++**
>> ++++++++++++++++
>>   templates/test_index.mako  | 49 ++++++++++++++++++++++++++++
>>   templates/test_result.mako | 47 +++++++++++++++++++++++++++
>>   3 files changed, 175 insertions(+)
>>   create mode 100644 templates/index.mako
>>   create mode 100644 templates/test_index.mako
>>   create mode 100644 templates/test_result.mako
>>
>> diff --git a/templates/index.mako b/templates/index.mako
>> new file mode 100644
>> index 0000000..acc597d
>> --- /dev/null
>> +++ b/templates/index.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<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
>> ">
>> +<html xmlns="http://www.w3.org/1999/**xhtml<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:
>> +                       % for i in ['index', 'changes', 'fixes',
>> 'problems', 'regressions', 'skipped']:
>> +                               % if i == page:
>> +          ${page}
>> +        % elif i == 'index':
>> +          % if page == 'all':
>> +          all
>> +          % else:
>> +          <a href="index.html">all</a>
>> +          % endif
>> +                               % else:
>> +                                       <a href="${i}.html">${i}</a>
>> +                               % endif
>> +                               % if i != "skipped":
>> +                                       |
>> +                               % endif
>> +                       % endfor
>>
>
> Since the first item in your list (index/all) is a special case, you might
> consider doing that outside the loop.  Then, you can put | before each
> link, and you won't have to special case 'skipped':
>
>
> % if page == 'all':
>     all
> % else:
>
>     <a href="index.html">all</a>
> % endif
>
> % for i in ['changes', 'fixes', 'problems', 'regressions', 'skipped']:
>
>     |
>     % if i == page:
>         ${page}
>     % else:
>
>         <a href="${i}.html">${i}</a>
>     % endif:
> % endfor
>
> It's a bit tidier that way.  (I probably botched the indenting, I haven't
> yet learned how that works in Mako...)
>
>
>  +               </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_index.mako b/templates/test_index.mako
>> new file mode 100644
>> index 0000000..edfab91
>> --- /dev/null
>> +++ b/templates/test_index.mako
>>
>
> Perhaps call this test_run_info.mako?  This page contains system info, and
> the link to get there is "(info)", so that name makes it pretty clear what
> the page is at a glance.
>
> In contrast, "test" makes me think of an individual test (rather than a
> whole test run) and "index" is pretty generic.
>
> I don't feel too strongly about it though.
>
>
>  @@ -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<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
>> ">
>> +<html xmlns="http://www.w3.org/1999/**xhtml<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>
>> diff --git a/templates/test_result.mako b/templates/test_result.mako
>> new file mode 100644
>> index 0000000..1f944cb
>> --- /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<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
>> ">
>> +<html xmlns="http://www.w3.org/1999/**xhtml<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>
>>
>
> Other than those suggestions, this looks good to me!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130525/057e3087/attachment-0001.html>


More information about the Piglit mailing list