[Piglit] [PATCH V3 07/10] summary: Build subdirectories for subtest result pages
Dylan Baker
baker.dylan.c at gmail.com
Tue May 28 13:17:52 PDT 2013
With 10,000+ tests all living in the same folder it can be hard to
identify a single file, especially when trying to work with the HTML
generation itself. This patch changes the behavior so that each test
has a directory tree for the group results with tests under it (ie
spec/GLSL 1.0/foo/bar/test.html)
A side effect of this is that the group names of tests don't have to be
altered to create a valid name (since the slashes in the group names
just become the slashes in the folder structure) and this was the single
most expensive operation of HTML generation (about 1/3 of the total
time). This is a tidy little speedup.
V3: Correct some spelling errors/remove excess comments
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/summary.py | 32 ++++++++++++++++++--------------
templates/test_result.mako | 6 +++---
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/framework/summary.py b/framework/summary.py
index 1ce3fa7..79ed20c 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -264,14 +264,6 @@ Returns an array of all child TestSummary instances.
## New Summary
-def sanitizePath(path):
- """
- Helper function to remove illegal characters from the names
- """
- return filter(lambda s: s.isalnum() or s == '_', path.replace('/', '__')) \
- + '.html'
-
-
class Result:
"""
Object that opens, reads, and stores the data in a resultfile.
@@ -481,8 +473,7 @@ class HTMLIndex(list):
"""
self.append({'type': 'testResult',
'class': text,
- 'href': path.join(sanitizePath(group),
- sanitizePath(href + ".html")),
+ 'href': path.join(group, href + ".html"),
'text': text})
@@ -721,6 +712,9 @@ class NewSummary:
output_encoding="utf-8",
module_directory=".makotmp")
+ resultCss = path.join(destination, "result.css")
+ index = path.join(destination, "index.html")
+
# Iterate across the tests creating the various test specific files
for each in self.results:
os.mkdir(path.join(destination, each.name))
@@ -733,17 +727,27 @@ class NewSummary:
lspci=each.lspci))
file.close()
+
# Then build the individual test results
for key, value in each.tests.iteritems():
- file = open(path.join(destination,
- each.name,
- sanitizePath(key + ".html")), 'w')
+ 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']))
+ command=value['command'],
+ css=path.relpath(resultCss, tPath),
+ index=index))
file.close()
# Finally build the root html files: index, regressions, etc
diff --git a/templates/test_result.mako b/templates/test_result.mako
index b4c6921..c0e0fca 100644
--- a/templates/test_result.mako
+++ b/templates/test_result.mako
@@ -5,7 +5,7 @@
<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" />
+ <link rel="stylesheet" href="${css}" type="text/css" />
</head>
<body>
<h1>Results for ${testname}</h1>
@@ -14,7 +14,7 @@
<p><b>Status:</b> ${status}</p>
<p><b>Result:</b> ${status}</p>
</div>
- <p><a href="../index.html">Back to summary</a></p>
+ <p><a href="${index}">Back to summary</a></p>
<h2>Details</h2>
<table>
<tr>
@@ -42,6 +42,6 @@
</td>
</tr>
</table>
- <p><a href="../index.html">Back to summary</a></p>
+ <p><a href="${index}">Back to summary</a></p>
</body>
</html>
--
1.8.1.4
More information about the Piglit
mailing list