Make a builder group support+expect multiple loads.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2012 06:38:30 +0000 (06:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2012 06:38:30 +0000 (06:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88260

Change BuilderGroup to allow expecting multiple
loads.  This allows merging results for a given set
of builders into one group.

Add a test that verifies that the group count
increments correctly based on successful and failed
list loads.

Patch by Chase Phillips <cmp@google.com> on 2012-06-04
Reviewed by Ojan Vafai.

* TestResultServer/static-dashboards/builders.js:
(BuilderGroup):
(BuilderGroup.prototype.setbuilder):
(BuilderGroup.prototype.append):
(BuilderGroup.prototype.loaded):
(requestBuilderList.xhr.onload):
(requestBuilderList.xhr.onerror):
(onErrorLoadingBuilderList):
(loadBuildersList):
* TestResultServer/static-dashboards/flakiness_dashboard_unittests.js:
(test):
* TestResultServer/static-dashboards/run-unittests.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119463 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/TestResultServer/static-dashboards/builders.js
Tools/TestResultServer/static-dashboards/flakiness_dashboard_unittests.js
Tools/TestResultServer/static-dashboards/run-unittests.html

index 21431dd..a0a8c43 100644 (file)
@@ -1,3 +1,31 @@
+2012-06-04  Chase Phillips  <cmp@google.com>
+
+        Make a builder group support+expect multiple loads.
+        https://bugs.webkit.org/show_bug.cgi?id=88260
+
+        Change BuilderGroup to allow expecting multiple
+        loads.  This allows merging results for a given set
+        of builders into one group.
+
+        Add a test that verifies that the group count
+        increments correctly based on successful and failed
+        list loads.
+
+        Reviewed by Ojan Vafai.
+
+        * TestResultServer/static-dashboards/builders.js:
+        (BuilderGroup):
+        (BuilderGroup.prototype.setbuilder):
+        (BuilderGroup.prototype.append):
+        (BuilderGroup.prototype.loaded):
+        (requestBuilderList.xhr.onload):
+        (requestBuilderList.xhr.onerror):
+        (onErrorLoadingBuilderList):
+        (loadBuildersList):
+        * TestResultServer/static-dashboards/flakiness_dashboard_unittests.js:
+        (test):
+        * TestResultServer/static-dashboards/run-unittests.html:
+
 2012-06-04  Ryosuke Niwa  <rniwa@webkit.org>
 
         Python test fix attempt for Chromium Windows.
index e9f45f1..c0aa049 100644 (file)
@@ -46,6 +46,9 @@ BuilderMaster.prototype.builderJsonPath = function()
 };
 
 CHROMIUM_BUILDER_MASTER = new BuilderMaster('Chromium', 'http://build.chromium.org/p/chromium/');
+CHROMIUM_WIN_BUILDER_MASTER = new BuilderMaster('ChromiumWin', 'http://build.chromium.org/p/chromium.win/');
+CHROMIUM_MAC_BUILDER_MASTER = new BuilderMaster('ChromiumMac', 'http://build.chromium.org/p/chromium.mac/');
+CHROMIUM_LINUX_BUILDER_MASTER = new BuilderMaster('ChromiumLinux', 'http://build.chromium.org/p/chromium.linux/');
 CHROMIUMOS_BUILDER_MASTER = new BuilderMaster('ChromiumChromiumOS', 'http://build.chromium.org/p/chromium.chromiumos/');
 CHROMIUM_GPU_BUILDER_MASTER = new BuilderMaster('ChromiumGPU', 'http://build.chromium.org/p/chromium.gpu/');
 CHROMIUM_GPU_FYI_BUILDER_MASTER = new BuilderMaster('ChromiumGPUFYI', 'http://build.chromium.org/p/chromium.gpu.fyi/');
@@ -61,20 +64,36 @@ var LEGACY_BUILDER_MASTERS_TO_GROUPS = {
     'webkit.org': '@ToT - webkit.org'
 };
 
-function BuilderGroup(isToTWebKit, builders)
+function BuilderGroup(isToTWebKit)
 {
     this.isToTWebKit = isToTWebKit;
     // Map of builderName (the name shown in the waterfall) to builderPath (the
     // path used in the builder's URL)
     this.builders = {};
+    this.groups = 0;
+    this.expectedGroups = 0;
+}
+
+BuilderGroup.prototype.setbuilder = function(builder, flags) {
+    this.builders[builder] = builder.replace(/[ .()]/g, '_');
+    // FIXME: Remove this at some point, we don't actually use DEFAULT_BUILDER
+    //        in any meaningful way anymore.  We always just default to the
+    //        first builder in alphabetical order.
+    if (flags & BuilderGroup.DEFAULT_BUILDER)
+        this.defaultBuilder = builder;
+};
+
+BuilderGroup.prototype.append = function(builders) {
     builders.forEach(function(builderAndFlags) {
         var builder = builderAndFlags[0];
         var flags = builderAndFlags[1];
-
-        this.builders[builder] = builder.replace(/[ .()]/g, '_');
-        if (flags & BuilderGroup.DEFAULT_BUILDER)
-            this.defaultBuilder = builder;
+        this.setbuilder(builder, flags);
     }, this);
+    this.groups += 1;
+};
+
+BuilderGroup.prototype.loaded = function() {
+    return this.groups >= this.expectedGroups;
 }
 
 BuilderGroup.prototype.setup = function()
@@ -98,8 +117,11 @@ function associateBuildersWithMaster(builders, master)
     });
 }
 
-function requestBuilderList(builderGroups, builderFilter, master, groupName, groupEnum)
+function requestBuilderList(builderGroups, builderFilter, master, groupName, groupEnum, builderGroup)
 {
+    if (!(groupName in builderGroups))
+        builderGroups[groupName] = builderGroup;
+
     var onLoad = partial(onBuilderListLoad, builderGroups, builderFilter, master, groupName, groupEnum);
     var xhr = new XMLHttpRequest();
     var url = master.builderJsonPath();
@@ -108,10 +130,11 @@ function requestBuilderList(builderGroups, builderFilter, master, groupName, gro
         if (xhr.status == 200)
             onLoad(JSON.parse(xhr.response));
         else
-            onErrorLoadingBuilderList(url);
+            onErrorLoadingBuilderList(url, builderGroups, groupName);
     };
-    xhr.onerror = function() { onErrorLoadingBuilderList(url); };
+    xhr.onerror = function() { onErrorLoadingBuilderList(url, builderGroups, groupName); };
     xhr.send();
+    builderGroups[groupName].expectedGroups += 1;
 }
 
 function isChromiumDepsGpuTestRunner(builder)
@@ -179,56 +202,70 @@ function onBuilderListLoad(builderGroups, builderFilter, master, groupName, grou
 {
     var builders = generateBuildersFromBuilderList(Object.keys(json), builderFilter);
     associateBuildersWithMaster(builders, master);
-    builderGroups[groupName] = new BuilderGroup(groupEnum, builders);
-    g_handleBuildersListLoaded();
+    builderGroups[groupName].append(builders);
+    if (builderGroups[groupName].loaded())
+        g_handleBuildersListLoaded();
 }
 
-function onErrorLoadingBuilderList(url)
+function onErrorLoadingBuilderList(url, builderGroups, groupName)
 {
-    alert('Could not load list of builders from ' + url + '. Try reloading.');
+    builderGroups[groupName].groups += 1;
+    console.log('Could not load list of builders from ' + url + '. Try reloading.');
 }
 
-function loadBuildersList(group, testType) {
+function loadBuildersList(groupName, testType) {
     if (testType == 'gpu_tests') {
-        switch(group) {
+        switch(groupName) {
         case '@DEPS - chromium.org':
-            requestBuilderList(CHROMIUM_GPU_TESTS_BUILDER_GROUPS, isChromiumDepsGpuTestRunner, CHROMIUM_GPU_BUILDER_MASTER, group, BuilderGroup.DEPS_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.DEPS_WEBKIT);
+            requestBuilderList(CHROMIUM_GPU_TESTS_BUILDER_GROUPS, isChromiumDepsGpuTestRunner, CHROMIUM_GPU_BUILDER_MASTER, groupName, BuilderGroup.DEPS_WEBKIT, builderGroup);
             break;
 
         case '@DEPS FYI - chromium.org':
-            requestBuilderList(CHROMIUM_GPU_TESTS_BUILDER_GROUPS, isChromiumDepsFyiGpuTestRunner, CHROMIUM_GPU_FYI_BUILDER_MASTER, group, BuilderGroup.DEPS_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.DEPS_WEBKIT);
+            requestBuilderList(CHROMIUM_GPU_TESTS_BUILDER_GROUPS, isChromiumDepsFyiGpuTestRunner, CHROMIUM_GPU_FYI_BUILDER_MASTER, groupName, BuilderGroup.DEPS_WEBKIT, builderGroup);
             break;
 
         case '@ToT - chromium.org':
-            requestBuilderList(CHROMIUM_GPU_TESTS_BUILDER_GROUPS, isChromiumTipOfTreeGpuTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, group, BuilderGroup.TOT_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.TOT_WEBKIT);
+            requestBuilderList(CHROMIUM_GPU_TESTS_BUILDER_GROUPS, isChromiumTipOfTreeGpuTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, groupName, BuilderGroup.TOT_WEBKIT, builderGroup);
             break;
         }
     } else if (testType == 'layout-tests') {
-        switch(group) {
+        switch(groupName) {
         case '@ToT - chromium.org':
-            requestBuilderList(LAYOUT_TESTS_BUILDER_GROUPS, isChromiumWebkitTipOfTreeTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, group, BuilderGroup.TOT_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.TOT_WEBKIT);
+            requestBuilderList(LAYOUT_TESTS_BUILDER_GROUPS, isChromiumWebkitTipOfTreeTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, groupName, BuilderGroup.TOT_WEBKIT, builderGroup);
             break;
 
         case '@ToT - webkit.org':
-            requestBuilderList(LAYOUT_TESTS_BUILDER_GROUPS, isWebkitTestRunner, WEBKIT_BUILDER_MASTER, group, BuilderGroup.TOT_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.TOT_WEBKIT);
+            requestBuilderList(LAYOUT_TESTS_BUILDER_GROUPS, isWebkitTestRunner, WEBKIT_BUILDER_MASTER, groupName, BuilderGroup.TOT_WEBKIT, builderGroup);
             break;
 
         case '@DEPS - chromium.org':
-            requestBuilderList(LAYOUT_TESTS_BUILDER_GROUPS, isChromiumWebkitDepsTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, group, BuilderGroup.DEPS_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.DEPS_WEBKIT);
+            requestBuilderList(LAYOUT_TESTS_BUILDER_GROUPS, isChromiumWebkitDepsTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, groupName, BuilderGroup.DEPS_WEBKIT, builderGroup);
             break;
         }
     } else {
-        switch(group) {
+        switch(groupName) {
         case '@DEPS - chromium.org':
-            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_BUILDER_MASTER, group, BuilderGroup.DEPS_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.DEPS_WEBKIT);
+            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_BUILDER_MASTER, groupName, BuilderGroup.DEPS_WEBKIT, builderGroup);
+            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_WIN_BUILDER_MASTER, groupName, BuilderGroup.DEPS_WEBKIT, builderGroup);
+            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_MAC_BUILDER_MASTER, groupName, BuilderGroup.DEPS_WEBKIT, builderGroup);
+            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsGTestRunner, CHROMIUM_LINUX_BUILDER_MASTER, groupName, BuilderGroup.DEPS_WEBKIT, builderGroup);
             break;
 
         case '@DEPS CrOS - chromium.org':
-            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsCrosGTestRunner, CHROMIUMOS_BUILDER_MASTER, group, BuilderGroup.DEPS_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.DEPS_WEBKIT);
+            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumDepsCrosGTestRunner, CHROMIUMOS_BUILDER_MASTER, groupName, BuilderGroup.DEPS_WEBKIT, builderGroup);
             break;
 
         case '@ToT - chromium.org':
-            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumTipOfTreeGTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, group, BuilderGroup.TOT_WEBKIT);
+            var builderGroup = new BuilderGroup(BuilderGroup.TOT_WEBKIT);
+            requestBuilderList(CHROMIUM_GTESTS_BUILDER_GROUPS, isChromiumTipOfTreeGTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, groupName, BuilderGroup.TOT_WEBKIT, builderGroup);
             break;
         }
     }
index 9c75bc5..2f7be14 100644 (file)
@@ -630,18 +630,37 @@ test('addBuilderLoadErrors', 1, function() {
 test('builderGroupIsToTWebKitAttribute', 2, function() {
     var dummyMaster = new BuilderMaster('dummy.org', 'http://build.dummy.org');
     var testBuilderGroups = {
-        '@ToT - dummy.org': null,
-        '@DEPS - dummy.org': null,
+        '@ToT - dummy.org': new BuilderGroup(BuilderGroup.TOT_WEBKIT),
+        '@DEPS - dummy.org': new BuilderGroup(BuilderGroup.DEPS_WEBKIT),
     }
-    var testJSONData = "{ \"Dummy Builder 1\": null, \"Dummy Builder 2\": null }";
+    testBuilderGroups['@ToT - dummy.org'].expectedGroups = 1;
+    testBuilderGroups['@DEPS - dummy.org'].expectedGroups = 1;
 
+    var testJSONData = "{ \"Dummy Builder 1\": null, \"Dummy Builder 2\": null }";
     onBuilderListLoad(testBuilderGroups,  function() { return true; }, dummyMaster, '@ToT - dummy.org', BuilderGroup.TOT_WEBKIT, JSON.parse(testJSONData));
     equal(testBuilderGroups['@ToT - dummy.org'].isToTWebKit, true);
-
     onBuilderListLoad(testBuilderGroups,  function() { return true; }, dummyMaster, '@DEPS - dummy.org', BuilderGroup.DEPS_WEBKIT, JSON.parse(testJSONData));
     equal(testBuilderGroups['@DEPS - dummy.org'].isToTWebKit, false);
 });
 
+test('builderGroupExpectedGroups', 4, function() {
+    var dummyMaster = new BuilderMaster('dummy.org', 'http://build.dummy.org');
+    var testBuilderGroups = {
+        '@ToT - dummy.org': new BuilderGroup(BuilderGroup.TOT_WEBKIT),
+    }
+    testBuilderGroups['@ToT - dummy.org'].expectedGroups = 3;
+
+    var testJSONData = "{ \"Dummy Builder 1\": null }";
+    equal(testBuilderGroups['@ToT - dummy.org'].expectedGroups, 3);
+    onBuilderListLoad(testBuilderGroups,  function() { return true; }, dummyMaster, '@ToT - dummy.org', BuilderGroup.TOT_WEBKIT, JSON.parse(testJSONData));
+    equal(testBuilderGroups['@ToT - dummy.org'].groups, 1);
+    var testJSONData = "{ \"Dummy Builder 2\": null }";
+    onBuilderListLoad(testBuilderGroups,  function() { return true; }, dummyMaster, '@ToT - dummy.org', BuilderGroup.TOT_WEBKIT, JSON.parse(testJSONData));
+    equal(testBuilderGroups['@ToT - dummy.org'].groups, 2);
+    onErrorLoadingBuilderList('http://build.dummy.org', testBuilderGroups,  '@ToT - dummy.org');
+    equal(testBuilderGroups['@ToT - dummy.org'].groups, 3);
+});
+
 test('sortTests', 4, function() {
     var test1 = createResultsObjectForTest('foo/test1.html', 'dummyBuilder');
     var test2 = createResultsObjectForTest('foo/test2.html', 'dummyBuilder');
index b7451b5..5fd81d5 100644 (file)
@@ -52,9 +52,11 @@ function g_handleBuildersListLoaded() {};
 
 <script>
 window.location.href = '#useTestData=true';
-var builderGroup = '@ToT - chromium.org';
+var groupName = '@ToT - chromium.org';
 var builders = {'Webkit Linux': '', 'Webkit Linux (dbg)': '', 'Webkit Mac10.5': '', 'Webkit Win': ''};
-onBuilderListLoad(LAYOUT_TESTS_BUILDER_GROUPS, isChromiumWebkitTipOfTreeTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, builderGroup, BuilderGroup.TOT_WEBKIT, builders);
+LAYOUT_TESTS_BUILDER_GROUPS[groupName] = new BuilderGroup(BuilderGroup.TOT_WEBKIT);
+LAYOUT_TESTS_BUILDER_GROUPS[groupName].expectedGroups = 4;
+onBuilderListLoad(LAYOUT_TESTS_BUILDER_GROUPS, isChromiumWebkitTipOfTreeTestRunner, CHROMIUM_WEBKIT_BUILDER_MASTER, groupName, BuilderGroup.TOT_WEBKIT, builders);
 initBuilders();
 </script>