diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2013-05-01 17:48:33 -0700 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2013-05-31 14:11:21 -0700 |
commit | a4c72292ba80fd221fbc329d79685fa7b92e436e (patch) | |
tree | 666ab0d4e217e073ed490cf996d4ce5b8620460d | |
parent | 2c0f2210100b4552ee8d2afb76e746df84afb57a (diff) |
summary: Build subdirectories for subtest result pages
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)
V3: - Correct some spelling errors/remove excess comments
Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-By: Aaron Watry <awatry@gmail.com>
Reviewed-By: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r-- | framework/summary.py | 32 | ||||
-rw-r--r-- | templates/test_result.mako | 6 |
2 files changed, 21 insertions, 17 deletions
diff --git a/framework/summary.py b/framework/summary.py index 216ec12d9..503744066 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(core.TestrunResult): """ Object that opens, reads, and stores the data in a resultfile. @@ -476,8 +468,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}) @@ -716,6 +707,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)) @@ -728,11 +722,19 @@ 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.get('result', 'None'), returncode=value.get('returncode', @@ -740,7 +742,9 @@ class NewSummary: time=value.get('time', 'None'), info=value.get('info', 'None'), command=value.get('command', - 'None'))) + 'None'), + 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 b4c692185..c0e0fcab1 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> |