Skip to content
Permalink
Browse files
2011-04-13 Ojan Vafai <ojan@chromium.org>
        Reviewed by Eric Seidel.

        generated unexpected_results.html from unexpected_results.json
        https://bugs.webkit.org/show_bug.cgi?id=52763

        Eventually, we'll merge this with results.html and have a single richer results page.
        For now, I just want to get something checked in that we can iterate on.

        * Scripts/webkitpy/layout_tests/layout_package/json_results.html: Added.
        * Scripts/webkitpy/layout_tests/layout_package/test_runner.py:

Canonical link: https://commits.webkit.org/73556@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83799 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ojanvafai committed Apr 14, 2011
1 parent 49d7aa6 commit 384dec41d598fe52505858e791a2d7c0e1f496cf
Showing 3 changed files with 130 additions and 0 deletions.
@@ -1,3 +1,16 @@
2011-04-13 Ojan Vafai <ojan@chromium.org>

Reviewed by Eric Seidel.

generated unexpected_results.html from unexpected_results.json
https://bugs.webkit.org/show_bug.cgi?id=52763

Eventually, we'll merge this with results.html and have a single richer results page.
For now, I just want to get something checked in that we can iterate on.

* Scripts/webkitpy/layout_tests/layout_package/json_results.html: Added.
* Scripts/webkitpy/layout_tests/layout_package/test_runner.py:

2011-04-13 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.
@@ -0,0 +1,111 @@
<!DocType html>
<style>
tr:hover {
opacity: 0.7
}

tr:nth-child(odd) {
background-color: #E3E9FF;
}

thead tr, tr:nth-child(even) {
background-color: #BCF;
}

td {
padding: 0 40px;
}

th:empty, td:empty {
padding: 0;
}
</style>

<script>
var results;
function ADD_RESULTS(input)
{
results = input;
}
</script>

<!-- FIXME: once we are happy with this page, load full_results.json
and have a checkbox to show only unexpected results. -->
<script src="unexpected_results.json"></script>

<script>
function stripExtension(test)
{
var index = test.lastIndexOf('.');
return test.substring(0, index);
}

var html = 'Tests where results did not match expected results:<table>' +
'<thead><tr>' +
'<th>test</th>' +
'<th id="text-results-header">text results</th>' +
'<th id="image-results-header">image results</th>' +
'<th>failure type</th>' +
'<th>expected failure type</th>' +
'</tr></thead>';

// FIXME: Should this point to the local file instead? Should it dynamically figure out where to point?
// FIXME: remove the version number from the URL if possible.
var test_base_path = 'http://trac.webkit.org/export/76053/trunk/LayoutTests/';

function resultLink(test_prefix, suffix, contents)
{
return '<a href="' + test_prefix + suffix + '">' + contents + '</a> ';
}

// FIXME: allow sorting the table by columns
// FIXME: show expected/actual/diff contents inline in iframes
// FIXME: allow zooming in on pixel diffs
// FIXME: store stderr information in the json
// FIXME: don't show expected failure type for non-chromium ports

var hasTextFailures = false;
var hasImageFailures = false;

for (var test in results.tests) {
var row = '<td><a href="' + test_base_path + test + '">' + test + '</a></td>';
var test_prefix = stripExtension(test);

row += '<td>';
var actual = results.tests[test].actual;
// FIXME: only include timeout actual/expected results here if we actually spit out results for timeout tests.
if (actual == 'CRASH')
row += resultLink(test, '-stack.txt', 'stack');
else if (actual.indexOf('TEXT' || actual == 'TIMEOUT') != -1) {
hasTextFailures = true;
// FIXME: Show wdiff here too?
// FIXME: store a bit in the JSON as to whether pretty-diff/wdiffs were generated
row += resultLink(test, '-expected.txt', 'expected') +
resultLink(test, '-actual.txt', 'actual') +
resultLink(test, '-diff.txt', 'diff') +
resultLink(test, '-pretty-diff.html', 'pretty diff');
}

row += '</td><td>';

if (actual.indexOf('IMAGE') != -1) {
hasImageFailures = true;
row += resultLink(test, '-expected.png', 'expected') +
resultLink(test, '-actual.png', 'actual') +
resultLink(test, '-diff.png', 'diff');
}

row += '</td>';
// FIXME: Handle stderr output.
row += '<td>' + actual + '</td>';
row += '<td>' + results.tests[test].expected + '</td>';
html += '<tr>' + row + '</tr>';
}

document.write(html);

if (!hasTextFailures)
document.body.querySelector('#text-results-header').textContent = '';
if (!hasImageFailures)
document.body.querySelector('#image-results-header').textContent = '';
</script>
@@ -714,6 +714,7 @@ def run(self, result_summary):
wrote_results = self._write_results_html_file(result_summary)
if self._options.show_results and wrote_results:
self._show_results_html_file()
self._write_unexpected_results_html_file(unexpected_results)

# Now that we've completed all the processing we can, we re-raise
# a KeyboardInterrupt if necessary so the caller can handle it.
@@ -1190,6 +1191,11 @@ def _write_results_html_file(self, result_summary):

return True

# FIXME: Have this replace results.html and have a checkbox for whether to show expected failures or not.
def _write_unexpected_results_html_file(self, unexpected_results):
base_dir = self._port.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'layout_tests', 'layout_package')
self._fs.copyfile(self._fs.join(base_dir, "json_results.html"), self._fs.join(self._results_directory, "json_results.html"))

def _show_results_html_file(self):
"""Shows the results.html page."""
results_filename = self._fs.join(self._results_directory, "results.html")

0 comments on commit 384dec4

Please sign in to comment.