Title: [95069] trunk/Tools
Revision
95069
Author
[email protected]
Date
2011-09-13 18:24:36 -0700 (Tue, 13 Sep 2011)

Log Message

garden-o-matic has unfriendly error messages when the local server is not available
https://bugs.webkit.org/show_bug.cgi?id=68042

Reviewed by Dimitri Glazkov.

This patch moves us from using alert to showing the error inline in the
progress dialog.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout_unittests.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui.js:

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout.js (95068 => 95069)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout.js	2011-09-14 01:23:14 UTC (rev 95068)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout.js	2011-09-14 01:24:36 UTC (rev 95069)
@@ -29,10 +29,9 @@
 
 var kWebKitTrunk = 'http://svn.webkit.org/repository/webkit/trunk/';
 
-var g_unavailableCheckoutCallback = null;
 var g_haveSeenCheckoutAvailable = false;
 
-function callIfCheckoutAvailable(callback)
+function callIfCheckoutAvailable(callback, checkoutUnavailable)
 {
     if (g_haveSeenCheckoutAvailable) {
         callback();
@@ -44,16 +43,11 @@
             callback();
             return;
         }
-        if (g_unavailableCheckoutCallback)
-            g_unavailableCheckoutCallback();
+        if (checkoutUnavailable)
+            checkoutUnavailable();
     });
 }
 
-checkout.registerUnavailableCheckoutCallback = function(unavailableCheckoutCallback)
-{
-    g_unavailableCheckoutCallback = unavailableCheckoutCallback;
-};
-
 checkout.subversionURLForTest = function(testName)
 {
     return kWebKitTrunk + 'LayoutTests/' + testName;
@@ -72,16 +66,16 @@
     });
 };
 
-checkout.updateExpectations = function(failureInfoList, callback)
+checkout.updateExpectations = function(failureInfoList, callback, checkoutUnavailable)
 {
     callIfCheckoutAvailable(function() {
         net.post(config.kLocalServerURL + '/updateexpectations', JSON.stringify(failureInfoList), function() {
             callback();
         });
-    });
+    }, checkoutUnavailable);
 };
 
-checkout.optimizeBaselines = function(testName, callback)
+checkout.optimizeBaselines = function(testName, callback, checkoutUnavailable)
 {
     callIfCheckoutAvailable(function() {
         net.post(config.kLocalServerURL + '/optimizebaselines?' + $.param({
@@ -89,10 +83,10 @@
         }), function() {
             callback();
         });
-    });
+    }, checkoutUnavailable);
 };
 
-checkout.rollout = function(revision, reason, callback)
+checkout.rollout = function(revision, reason, callback, checkoutUnavailable)
 {
     callIfCheckoutAvailable(function() {
         net.post(config.kLocalServerURL + '/rollout?' + $.param({
@@ -101,10 +95,10 @@
         }), function() {
             callback();
         });
-    });
+    }, checkoutUnavailable);
 };
 
-checkout.rebaseline = function(failureInfoList, callback, progressCallback)
+checkout.rebaseline = function(failureInfoList, callback, progressCallback, checkoutUnavailable)
 {
     callIfCheckoutAvailable(function() {
         base.callInSequence(function(failureInfo, callback) {
@@ -120,7 +114,7 @@
             var testNameList = base.uniquifyArray(failureInfoList.map(function(failureInfo) { return failureInfo.testName; }));
             base.callInSequence(checkout.optimizeBaselines, testNameList, callback);
         });
-    });
+    }, checkoutUnavailable);
 };
 
 })();

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout_unittests.js (95068 => 95069)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout_unittests.js	2011-09-14 01:23:14 UTC (rev 95068)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout_unittests.js	2011-09-14 01:24:36 UTC (rev 95069)
@@ -50,6 +50,8 @@
             'testName': 'another/test.svg',
         }], function() {
             ok(true);
+        }, function() {
+            ok(false);
         });
     });
 });
@@ -69,7 +71,7 @@
     });
 });
 
-test("rebaseline", 3, function() {
+test("rebaseline", 7, function() {
     var simulator = new NetworkSimulator();
 
     var requestedURLs = [];
@@ -78,7 +80,18 @@
         requestedURLs.push(url);
         simulator.scheduleCallback(callback);
     };
+    simulator.ajax = function(options)
+    {
+        ok(options.url.indexOf('/ping') != -1);
+        simulator.scheduleCallback(options.success);
+    };
 
+    var kExpectedTestNameProgressStack = [
+        'fast/test.html',
+        'another/test.svg',
+        'another/test.svg', // This is the first one.
+    ];
+
     simulator.runTest(function() {
         checkout.rebaseline([{
             'builderName': 'WebKit Linux',
@@ -91,6 +104,10 @@
             'testName': 'fast/test.html',
         }], function() {
             ok(true);
+        }, function(failureInfo) {
+            equals(failureInfo.testName, kExpectedTestNameProgressStack.pop());
+        }, function() {
+            ok(false, 'Checkout should be available.');
         });
     });
 

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js (95068 => 95069)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js	2011-09-14 01:23:14 UTC (rev 95068)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js	2011-09-14 01:24:36 UTC (rev 95069)
@@ -27,35 +27,31 @@
 
 (function(){
 
+var kCheckoutUnavailableMessage = 'Failed! Garden-o-matic needs a local server to modify your working copy. Please run "webkit-patch garden-o-matic" start the local server.';
+
 // FIXME: Where should this function go?
 function rebaselineWithStatusUpdates(failureInfoList)
 {
-    var statusView = new ui.MessageBox(
-        'Rebaseline',
-        'Performing rebaseline...');
+    var statusView = new ui.MessageBox('Rebaseline', 'Performing rebaseline...');
 
     checkout.rebaseline(failureInfoList, function() {
-        statusView.addMessage('Rebaseline done! Please land with "webkit-patch land-cowboy".');
-
-        statusView.addActionList(new ui.actions.List([new ui.actions.Close()]));
-        $(statusView).bind('close', statusView.close.bind(statusView));
+        statusView.addFinalMessage('Rebaseline done! Please land with "webkit-patch land-cowboy".');
     }, function(failureInfo) {
         statusView.addMessage(failureInfo.testName + ' on ' + ui.displayNameForBuilder(failureInfo.builderName));
+    }, function() {
+        statusView.addFinalMessage(kCheckoutUnavailableMessage);
     });
 }
 
 // FIXME: Where should this function go?
-// FIXME: This should share more code with rebaselineWithStatusUpdates.
 function updateExpectationsWithStatusUpdates(failureInfoList)
 {
-    var statusView = new ui.MessageBox(
-        'Expectations Update',
-        'Updating expectations...');
+    var statusView = new ui.MessageBox('Expectations Update', 'Updating expectations...');
 
     checkout.updateExpectations(failureInfoList, function() {
-        statusView.addMessage('Expectations update done! Please land with "webkit-patch land-cowboy".');
-        statusView.addActionList(new ui.actions.List([new ui.actions.Close()]));
-        $(statusView).bind('close', statusView.close.bind(statusView));
+        statusView.addFinalMessage('Expectations update done! Please land with "webkit-patch land-cowboy".');
+    }, function() {
+        statusView.addFinalMessage(kCheckoutUnavailableMessage);
     });
 }
 
@@ -212,7 +208,10 @@
     },
     onRollout: function(revision, testNameList)
     {
-        checkout.rollout(revision, ui.rolloutReasonForTestNameList(testNameList), $.noop);
+        checkout.rollout(revision, ui.rolloutReasonForTestNameList(testNameList), $.noop, function() {
+            // FIXME: We should have a better error UI.
+            alert(kCheckoutUnavailableMessage);
+        });
     }
 });
 

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js (95068 => 95069)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js	2011-09-14 01:23:14 UTC (rev 95068)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js	2011-09-14 01:24:36 UTC (rev 95069)
@@ -57,10 +57,6 @@
 $(document).ready(function() {
     g_updateTimerId = window.setInterval(update, config.kUpdateFrequency);
 
-    checkout.registerUnavailableCheckoutCallback(function() {
-        alert('Please run "webkit-patch garden-o-matic" to enable this feature.');
-    });
-
     _onebar_ = new ui.onebar();
     onebar.attach();
 

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui.js (95068 => 95069)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui.js	2011-09-14 01:23:14 UTC (rev 95068)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui.js	2011-09-14 01:24:36 UTC (rev 95069)
@@ -158,9 +158,12 @@
         $(element).addClass('message').text(message);
         this._content.appendChild(element);
     },
-    addActionList: function(actionList)
+    // FIXME: It's unclear whether this code could live here or in a controller.
+    addFinalMessage: function(message)
     {
-        this.appendChild(actionList);
+        this.addMessage(message);
+        this.appendChild(new ui.actions.List([new ui.actions.Close()]));
+        $(statusView).bind('close', statusView.close.bind(statusView));
     }
 });
 

Modified: trunk/Tools/ChangeLog (95068 => 95069)


--- trunk/Tools/ChangeLog	2011-09-14 01:23:14 UTC (rev 95068)
+++ trunk/Tools/ChangeLog	2011-09-14 01:24:36 UTC (rev 95069)
@@ -1,5 +1,21 @@
 2011-09-13  Adam Barth  <[email protected]>
 
+        garden-o-matic has unfriendly error messages when the local server is not available
+        https://bugs.webkit.org/show_bug.cgi?id=68042
+
+        Reviewed by Dimitri Glazkov.
+
+        This patch moves us from using alert to showing the error inline in the
+        progress dialog.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/checkout_unittests.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/controllers.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/garden-o-matic.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui.js:
+
+2011-09-13  Adam Barth  <[email protected]>
+
         FailureGrid in garden-o-matic should link to the builder's waterfall page
         https://bugs.webkit.org/show_bug.cgi?id=68036
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to