Title: [100864] trunk/Tools
Revision
100864
Author
[email protected]
Date
2011-11-19 17:52:06 -0800 (Sat, 19 Nov 2011)

Log Message

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

Patch by Alice Boxhall <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (100863 => 100864)


--- trunk/Tools/ChangeLog	2011-11-20 01:47:13 UTC (rev 100863)
+++ trunk/Tools/ChangeLog	2011-11-20 01:52:06 UTC (rev 100864)
@@ -1,3 +1,15 @@
+2011-11-19  Alice Boxhall  <[email protected]>
+
+        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  <[email protected]>
 
         Stop storing results files as jsonp in the test results server

Modified: trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js (100863 => 100864)


--- trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js	2011-11-20 01:47:13 UTC (rev 100863)
+++ trunk/Tools/TestResultServer/static-dashboards/dashboard_base.js	2011-11-20 01:52:06 UTC (rev 100864)
@@ -469,6 +469,7 @@
 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 @@
         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 = ""
+        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 +

Modified: trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_tests.js (100863 => 100864)


--- trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_tests.js	2011-11-20 01:47:13 UTC (rev 100863)
+++ trunk/Tools/TestResultServer/static-dashboards/flakiness_dashboard_tests.js	2011-11-20 01:52:06 UTC (rev 100864)
@@ -95,7 +95,22 @@
     }
 }
 
-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()
 {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to