Commit 7f791577 authored by ojan@chromium.org's avatar ojan@chromium.org

Modify dashboard_base.js to optionally accept version 4 results json.

Patch by Alice Boxhall <aboxhall@chromium.org> on 2011-11-19
Reviewed by Ojan Vafai.

* TestResultServer/static-dashboards/dashboard_base.js:
(ADD_RESULTS):
(flattenTrie):
* TestResultServer/static-dashboards/flakiness_dashboard_tests.js:
(testFlattenTrie):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 73f67fdb
2011-11-19 Alice Boxhall <aboxhall@chromium.org>
Modify dashboard_base.js to optionally accept version 4 results json.
Reviewed by Ojan Vafai.
* TestResultServer/static-dashboards/dashboard_base.js:
(ADD_RESULTS):
(flattenTrie):
* TestResultServer/static-dashboards/flakiness_dashboard_tests.js:
(testFlattenTrie):
2011-11-19 Ojan Vafai <ojan@chromium.org>
Stop storing results files as jsonp in the test results server
......@@ -469,6 +469,7 @@ var g_resultsByBuilder = {};
var g_expectations;
function ADD_RESULTS(builds)
{
var json_version = builds['version'];
for (var builderName in builds) {
if (builderName == 'version')
continue;
......@@ -481,12 +482,34 @@ function ADD_RESULTS(builds)
if ((Date.now() / 1000) - lastRunSeconds > TWO_WEEKS_SECONDS)
continue;
if (json_version >= 4)
builds[builderName][TESTS_KEY] = flattenTrie(builds[builderName][TESTS_KEY]);
g_resultsByBuilder[builderName] = builds[builderName];
}
handleResourceLoad();
}
// TODO(aboxhall): figure out whether this is a performance bottleneck and
// change calling code to understand the trie structure instead if necessary.
function flattenTrie(trie, prefix)
{
var result = {};
for (var name in trie) {
var fullName = prefix ? prefix + "/" + name : name;
var data = trie[name];
if ("results" in data)
result[fullName] = data;
else {
var partialResult = flattenTrie(data, fullName);
for (var key in partialResult) {
result[key] = partialResult[key];
}
}
}
return result;
}
function pathToBuilderResultsFile(builderName)
{
return TEST_RESULTS_SERVER + 'testfile?builder=' + builderName +
......
......@@ -95,7 +95,22 @@ function assertEquals(actual, expected, message)
}
}
function throwError(resultsForTests, actual, expected) {}
function testFlattenTrie()
{
var tests = {
'bar.html': {'results': [[100, 'F']], 'times': [[100, 0]]},
'foo': {
'bar': {
'baz.html': {'results': [[100, 'F']], 'times': [[100, 0]]},
}
}
};
var expectedFlattenedTests = {
'bar.html': {'results': [[100, 'F']], 'times': [[100, 0]]},
'foo/bar/baz.html': {'results': [[100, 'F']], 'times': [[100, 0]]},
};
assertEquals(JSON.stringify(flattenTrie(tests)), JSON.stringify(expectedFlattenedTests))
}
function testReleaseFail()
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment