On 05/17/2013 09:31 AM, Dylan Baker wrote:
This provides a switch and method for excluding the generation of the
test result HTML files (those that live under <testrun name>/). This
allows the user to trade some verbosity in the results for a significant
increase in generation speed. A run of quick.tests with all options
enabled takes ~5.5 seconds, with just pass and skip disabled it only
takes ~2.5 seconds. This only becomes more significant as more testsruns
are added the HTML page.

Signed-off-by: Dylan Baker <[email protected]>
---
  framework/summary.py   | 65 ++++++++++++++++++++++++++++----------------------
  piglit-summary-html.py | 16 ++++++++++++-
  templates/index.mako   |  6 +++++
  3 files changed, 58 insertions(+), 29 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index 9f2a924..722912c 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -587,7 +587,7 @@ class NewSummary:
                  if status[i] > 1 and status[i + 1] == 1:
                      self.fixes.append(test)

-    def generateHTML(self, destination):
+    def generateHTML(self, destination, exclude):
          """
          Produce HTML summaries.

@@ -638,27 +638,30 @@ class NewSummary:
                  # times!
                  tPath = path.join(destination, each.name, path.dirname(key))

-                # os.makedirs is very annoying, it throws an OSError if the
-                # path requested already exists, so do this check to esnure
-                # that it doesn't
-                if not path.exists(tPath):
-                    os.makedirs(tPath)
-
-                file = open(path.join(destination,
-                                      each.name,
-                                      key + ".html"),
-                            'w')
-                file.write(testfile.render(testname   = key,
-                                           status     = value['result'],
-                                           returncode = value['returncode'],
-                                           time       = value['time'],
-                                           info       = value['info'],
-                                           command    = value['command'],
-                                           css        = path.relpath(resultCss,
-                                                                     tPath),
-                                           index      = index))
-
-                file.close()
+                # Do not generate test result pages for skips
+                if value['result'] not in exclude:
+                    # os.makedirs is very annoying, it throws an OSError if
+                    # the path requested already exists, so do this check to
+                    # ensure that it doesn't
+                    if not path.exists(tPath):
+                        os.makedirs(tPath)
+
+                    file = open(path.join(destination,
+                                          each.name,
+                                          key + ".html"),
+                                'w')
+                    file.write(
+                        testfile.render(testname   = key,
+                                        status     = value['result'],
+                                        returncode = value['returncode'],
+                                        time       = value['time'],
+                                        info       = value['info'],
+                                        command    = value['command'],
+                                        css        = path.relpath(resultCss,
+                                                                  tPath),
+                                        index      = index))
+
+                    file.close()

          # Finally build the root html files: index, regressions, etc
          index = Template(filename = "templates/index.mako",
@@ -669,35 +672,40 @@ class NewSummary:
          file = open(path.join(destination, "index.html"), 'w')
          file.write(index.render(results = BuildHTMLIndex(self, self.alltests),
                                  page    = 'all',
-                                colnum  = len(self.results)))
+                                colnum  = len(self.results),
+                                exclude = exclude))
          file.close()

          # changes.html
          file = open(path.join(destination, "changes.html"), 'w')
          file.write(index.render(results = BuildHTMLIndex(self, self.changes),
                                  page    = 'changes',
-                                colnum  = len(self.results)))
+                                colnum  = len(self.results),
+                                exclude = exclude))
          file.close()

          # problems.html
          file = open(path.join(destination, "problems.html"), 'w')
          file.write(index.render(results = BuildHTMLIndex(self, self.problems),
                                  page    = 'problems',
-                                colnum  = len(self.results)))
+                                colnum  = len(self.results),
+                                exclude = exclude))
          file.close()

          # skipped.html
          file = open(path.join(destination, "skipped.html"), 'w')
          file.write(index.render(results = BuildHTMLIndex(self, self.skipped),
                                  page    = 'skipped',
-                                colnum  = len(self.results)))
+                                colnum  = len(self.results),
+                                exclude = exclude))
          file.close()

          # fixes.html
          file = open(path.join(destination, "fixes.html"), 'w')
          file.write(index.render(results = BuildHTMLIndex(self, self.fixes),
                                  page    = 'fixes',
-                                colnum  = len(self.results)))
+                                colnum  = len(self.results),
+                                exclude = exclude))
          file.close()

          # regressions.html
@@ -705,7 +713,8 @@ class NewSummary:
          file.write(index.render(results = BuildHTMLIndex(self,
                                                           self.regressions),
                                  page    = 'regressions',
-                                colnum  = len(self.results)))
+                                colnum  = len(self.results),
+                                exclude = exclude))
          file.close()

      def _buildDictionary(self, summary):
diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index 77d63d0..4d2f1f0 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -44,6 +44,16 @@ def main():
      parser.add_argument("-l", "--list",
                          action  = "store",
                          help    = "Use test results from a list file")
+    parser.add_argument("-e", "--exclude-generation",

Perhaps call this --exclude-details?  It seems clearer to me.  Just an idea.

+                        default = [],
+                        action  = "append",
+                        choices = ['pass', 'warn', 'crash' 'fail', 'all'],

Shouldn't 'skip' be an option too? By 'skip' I mean tests that were executed but explicitly output 'skip' (say due to missing extensions), not missing tests that weren't present in a particular test run.

With those changes, this would get a:
Reviewed-by: Kenneth Graunke <[email protected]>

+                        help    = "Optionally exclude the generation of HTML"
+                                  "pages for individual test pages with the"
+                                  "status(es) given as arguments. This speeds"
+                                  "up HTML generation, but reduces the info"
+                                  "in the HTML pages. May be used multiple"
+                                  "times")
      parser.add_argument("summaryDir",
                          metavar = "<Summary Directory>",
                          help    = "Directory to put HTML files in")
@@ -57,6 +67,10 @@ def main():
      if not args.list and not args.resultsFiles:
          raise ValueError("Missing required options -l or <resultsFiles>")

+    # If exclude-results has all, then change it to be all
+    if 'all' in args.exclude_generation:
+        args.exclude_generation=['skip', 'pass', 'warn', 'crash', 'fail']
+
      # if overwrite is requested delete the output directory
      if path.exists(args.summaryDir) and args.overwrite:
          shutil.rmtree(args.summaryDir)
@@ -71,7 +85,7 @@ def main():

      # Create the HTML output
      output = summary.NewSummary(args.resultsFiles)
-    output.generateHTML(args.summaryDir)
+    output.generateHTML(args.summaryDir, args.exclude_generation)


  if __name__ == "__main__":
diff --git a/templates/index.mako b/templates/index.mako
index acc597d..e29ebcc 100644
--- a/templates/index.mako
+++ b/templates/index.mako
@@ -62,9 +62,15 @@
                                        </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']}">


_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to