[Piglit] [PATCH V3 09/10] HTML summary: Provides means to exclude generating test result files
Dylan Baker
baker.dylan.c at gmail.com
Tue May 28 13:17:54 PDT 2013
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.
V3: Remove some bad comments
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/summary.py | 45 +++++++++++++++++++++++++--------------------
piglit-summary-html.py | 17 ++++++++++++++++-
templates/index.mako | 6 ++++++
3 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/framework/summary.py b/framework/summary.py
index 79ed20c..fc08d2b 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -687,7 +687,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.
@@ -732,23 +732,26 @@ class NewSummary:
for key, value in each.tests.iteritems():
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 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()
+ 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",
@@ -765,7 +768,8 @@ class NewSummary:
file.write(index.render(results=HTMLIndex(self, 'alltests'),
page='all',
links=pages,
- colnum=len(self.results)))
+ colnum=len(self.results),
+ exclude=exclude))
file.close()
# Generate the rest of the pages
@@ -774,5 +778,6 @@ class NewSummary:
file.write(index.render(results=HTMLIndex(self, page),
page=page,
colnum=len(self.results),
- links=pages))
+ links=pages,
+ exclude=exclude))
file.close()
diff --git a/piglit-summary-html.py b/piglit-summary-html.py
index dc10b7d..5328255 100755
--- a/piglit-summary-html.py
+++ b/piglit-summary-html.py
@@ -51,6 +51,17 @@ def main():
help = "Load a newline seperated list of results. "
"These results will be prepended to any "
"Results specified on the command line")
+ parser.add_argument("-e", "--exclude-generation",
+ default = [],
+ action = "append",
+ choices = ['skip', 'pass', 'warn', 'crash' 'fail',
+ 'all'],
+ 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")
@@ -64,6 +75,10 @@ def main():
if not args.list and not args.resultsFiles:
raise parser.error("Missing required option -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)
@@ -77,7 +92,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 8ca4298..4bfb3c7 100644
--- a/templates/index.mako
+++ b/templates/index.mako
@@ -58,9 +58,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']}">
--
1.8.1.4
More information about the Piglit
mailing list