Title: [92134] trunk/Tools
Revision
92134
Author
aba...@webkit.org
Date
2011-08-01 12:23:21 -0700 (Mon, 01 Aug 2011)

Log Message

garden-o-matic shouldn't require local server to determine if compile failed
https://bugs.webkit.org/show_bug.cgi?id=65446

Reviewed by Dimitri Glazkov.

This patch adds some basic bindings for the buildbot JSON API.  I
wanted to use Buildbot.js an Builder.js from the original TestFailures,
but they make a number of WebKit-specific assumptions.  We'll
eventually need to reconcile these pieces of code.

I should really add tests for this code, but that will require me to
build a better mock network.  I'll be happy to do that in a follow-up
patch.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/builders.js: Added.
    - It's very unclear to me whether didFail is correct.  Supposedly
      the first entry here is the exit code of the step, which is 0 on
      success.  I suspect we'll need to improve this function over time.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/main.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/results.js:

Modified Paths

Added Paths

Diff

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/builders.js (0 => 92134)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/builders.js	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/builders.js	2011-08-01 19:23:21 UTC (rev 92134)
@@ -0,0 +1,72 @@
+var builders = builders || {};
+
+(function() {
+
+var kChromiumBuildBotURL = 'http://build.chromium.org/p/chromium.webkit';
+
+var kUpdateStepName = 'update';
+var kUpdateScriptsStepName = 'update_scripts';
+var kCompileStepName = 'compile';
+
+function urlForBuildInfo(builderName, buildNumber)
+{
+    return kChromiumBuildBotURL + '/json/builders/' + encodeURIComponent(builderName) + '/builds/' + encodeURIComponent(buildNumber);
+}
+
+function isStepRequredForTestCoverage(step)
+{
+    switch(step.name) {
+    case kUpdateStepName:
+    case kUpdateScriptsStepName:
+    case kCompileStepName:
+        return true;
+    default:
+        return false;
+    }
+}
+
+function didFail(step)
+{
+    // FIXME: Is this the correct way to test for failure?
+    return step.results[0] > 0;
+}
+
+function didFailStepRequredForTestCoverage(buildInfo)
+{
+    return buildInfo.steps.filter(isStepRequredForTestCoverage).filter(didFail).length > 0;
+}
+
+var g_buildInfoCache = new base.AsynchronousCache(function(key, callback) {
+    var explodedKey = key.split('\n');
+    $.get(urlForBuildInfo(explodedKey[0], explodedKey[1]), callback);
+});
+
+function fetchMostRecentBuildInfoByBuilder(callback)
+{
+    var buildInfoByBuilder = {};
+    var requestTracker = new base.RequestTracker(config.kBuilders.length, callback, [buildInfoByBuilder]);
+    $.get(kChromiumBuildBotURL + '/json/builders', function(builderStatus) {
+        $.each(config.kBuilders, function(index, builderName) {
+            var buildNumber = builderStatus[builderName].cachedBuilds.pop();
+
+            g_buildInfoCache.get(builderName + '\n' + buildNumber, function(buildInfo) {
+                buildInfoByBuilder[builderName] = buildInfo;
+                requestTracker.requestComplete();
+            });
+        });
+    });
+}
+
+builders.buildersFailingStepRequredForTestCoverage = function(callback)
+{
+    fetchMostRecentBuildInfoByBuilder(function(buildInfoByBuilder) {
+        var builderNameList = [];
+        $.each(buildInfoByBuilder, function(builderName, buildInfo) {
+            if (didFailStepRequredForTestCoverage(buildInfo))
+                builderNameList.push(builderName);
+        });
+        callback(builderNameList);
+    });
+};
+
+})();

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html (92133 => 92134)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html	2011-08-01 18:45:02 UTC (rev 92133)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html	2011-08-01 19:23:21 UTC (rev 92134)
@@ -32,6 +32,7 @@
 <script src=""
 <script src=""
 <script src=""
+<script src=""
 <script src=""
 <script src=""
 <script src=""

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/main.js (92133 => 92134)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/main.js	2011-08-01 18:45:02 UTC (rev 92133)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/main.js	2011-08-01 19:23:21 UTC (rev 92134)
@@ -221,9 +221,18 @@
     showBuilderProgress();
 }
 
+function showFailingBuildersInfobar(builderNameList)
+{
+    if (builderNameList.length)
+        displayInfobar(ui.infobarMessageForCompileErrors(builderNameList), kBuildFailedInfobarType);
+    else
+        hideInfobarIfOfType(kBuildFailedInfobarType);
+}
+
 function update()
 {
     displayOnButterbar('Loading...');
+    builders.buildersFailingStepRequredForTestCoverage(showFailingBuildersInfobar);
     base.callInParallel([model.updateRecentCommits, model.updateResultsByBuilder], function() {
         showRecentCommits();
         showBuilderProgress();

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/results.js (92133 => 92134)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/results.js	2011-08-01 18:45:02 UTC (rev 92133)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/results.js	2011-08-01 19:23:21 UTC (rev 92134)
@@ -451,30 +451,6 @@
     });
 };
 
-function isBuilderThatOnlyCompiles(builderName)
-{
-    return config.kBuildersThatOnlyCompile.indexOf(builderName) != -1;
-}
-
-// FIXME: This method isn't tested because we don't have a good strategy for
-// mocking out the network. Maybe all network requests should go through a
-// "net" module?
-results.fetchBuildersWithCompileErrors = function(callback) {
-    $.get('/buildbot', function(builderStatuses) {
-        var brokenBuilders = [];
-
-        $.each(builderStatuses, function(index, builderStatus) {
-            if (builderStatus['is_green'])
-                return;
-            var builderName = builderStatus['name'];
-            if (isBuilderThatOnlyCompiles(builderName))
-                brokenBuilders.push(builderName);
-        });
-
-        callback(brokenBuilders);
-    });
-};
-
 results.fetchResultsForBuilder = function(builderName, callback)
 {
     base.jsonp(resultsSummaryURL(builderName, kResultsName), function(resultsTree) {

Modified: trunk/Tools/ChangeLog (92133 => 92134)


--- trunk/Tools/ChangeLog	2011-08-01 18:45:02 UTC (rev 92133)
+++ trunk/Tools/ChangeLog	2011-08-01 19:23:21 UTC (rev 92134)
@@ -1,5 +1,29 @@
 2011-08-01  Adam Barth  <aba...@webkit.org>
 
+        garden-o-matic shouldn't require local server to determine if compile failed
+        https://bugs.webkit.org/show_bug.cgi?id=65446
+
+        Reviewed by Dimitri Glazkov.
+
+        This patch adds some basic bindings for the buildbot JSON API.  I
+        wanted to use Buildbot.js an Builder.js from the original TestFailures,
+        but they make a number of WebKit-specific assumptions.  We'll
+        eventually need to reconcile these pieces of code.
+
+        I should really add tests for this code, but that will require me to
+        build a better mock network.  I'll be happy to do that in a follow-up
+        patch.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/builders.js: Added.
+            - It's very unclear to me whether didFail is correct.  Supposedly
+              the first entry here is the exit code of the step, which is 0 on
+              success.  I suspect we'll need to improve this function over time.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/main.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/results.js:
+
+2011-08-01  Adam Barth  <aba...@webkit.org>
+
         garden-o-matic should show all failures, even ones that it can't find a regression range for
         https://bugs.webkit.org/show_bug.cgi?id=65447
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to