[Piglit] [PATCH 02/16] summary.py: Do not generate comparison pages for single results

Dylan Baker baker.dylan.c at gmail.com
Thu Jun 13 08:36:09 PDT 2013


It is absolutely silly to generate pages for fixes, changes, and
regressions when there is only one test result is provided. This still
generates empty pages when two results are provided, because some
developers have expressed a work flow that uses these empty pages.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/summary.py | 9 ++++++++-
 templates/index.mako | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index bd0f4cd..a2794d9 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -757,7 +757,12 @@ class NewSummary:
                          module_directory=".makotmp")
 
         # A list of pages to be generated
-        pages = ['changes', 'problems', 'skipped', 'fixes', 'regressions']
+        # If there is only one set of results, then there cannot be changes,
+        # regressions or fixes, so don't generate those pages
+        if len(self.results) > 1:
+            pages = ['changes', 'problems', 'skipped', 'fixes', 'regressions']
+        else:
+            pages = ['problems', 'skipped']
 
         # 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,
@@ -765,6 +770,7 @@ class NewSummary:
         file = open(path.join(destination, "index.html"), 'w')
         file.write(index.render(results=HTMLIndex(self, self.tests['all']),
                                 page='all',
+                                pages=pages,
                                 colnum=len(self.results),
                                 exclude=exclude))
         file.close()
@@ -774,6 +780,7 @@ class NewSummary:
             file = open(path.join(destination, page + '.html'), 'w')
             file.write(index.render(results=HTMLIndex(self, self.tests[page]),
                                     page=page,
+                                    pages=pages,
                                     colnum=len(self.results),
                                     exclude=exclude))
             file.close()
diff --git a/templates/index.mako b/templates/index.mako
index ea3ec76..e959a27 100644
--- a/templates/index.mako
+++ b/templates/index.mako
@@ -16,7 +16,7 @@
       % else:
         <a href="index.html">all</a>
       % endif
-      % for i in ['changes', 'fixes', 'problems', 'regressions', 'skipped']:
+      % for i in pages:
         % if i == page:
           | ${i}
         % else:
-- 
1.8.1.4



More information about the Piglit mailing list