build.webkit.org/dashboard shows obsolete results when builds are substantially out...
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Apr 2015 00:08:29 +0000 (00:08 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Apr 2015 00:08:29 +0000 (00:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138630

Reviewed by Tim Horton.

Make sure that we always load at least one in order productive iteration.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
(BuildbotQueue): Added _hasLoadedIterationForInOrderResult to track whether the queue
is done loading at least one iteration that wasn't an out of order build.
(BuildbotQueue.prototype.loadMoreHistoricalIterations): Listen for iteration load
when that's needed to check for out of order builds.
(BuildbotQueue.prototype.update): Ditto.
(BuildbotQueue.prototype._checkForInOrderResult): Check if the queue has an in order
result, and if it does not, load more iterations.
(BuildbotQueue.prototype.loadAll): We have everything loaded, so we certainly have
an in order iteration loaded too.
(BuildbotQueue.prototype.compareIterations): Extracted from sortIterations(), and
corrected to always sort loaded iterations before unloaded ones.

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

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js
Tools/ChangeLog

index f66c7b6..db1f1be 100644 (file)
@@ -47,6 +47,11 @@ BuildbotQueue = function(buildbot, id, info)
 
     this.iterations = [];
     this._knownIterations = {};
+
+    // Some queues process changes out of order, but we need to display results for the latest commit,
+    // not the latest build. BuildbotQueue ensures that at least one productive iteration
+    // that was run in order gets loaded (if the queue had any productive iterations, of course).
+    this._hasLoadedIterationForInOrderResult = false;
 };
 
 BaseObject.addConstructorFunctions(BuildbotQueue);
@@ -178,6 +183,8 @@ BuildbotQueue.prototype = {
             if (!iteration.loaded) {
                 if (indexOfFirstNewlyLoadingIteration === undefined)
                     indexOfFirstNewlyLoadingIteration = i;
+                if (!this._hasLoadedIterationForInOrderResult)
+                    iteration.addEventListener(BuildbotIteration.Event.Updated, this._checkForInOrderResult.bind(this));
                 iteration.update();
             }
         }
@@ -206,8 +213,11 @@ BuildbotQueue.prototype = {
                     this._knownIterations[iteration.id] = iteration;
                 }
 
-                if (i >= loadingStop && (!iteration.finished || !iteration.loaded))
+                if (i >= loadingStop && (!iteration.finished || !iteration.loaded)) {
+                    if (!this._hasLoadedIterationForInOrderResult)
+                        iteration.addEventListener(BuildbotIteration.Event.Updated, this._checkForInOrderResult.bind(this));
                     iteration.update();
+                }
             }
 
             if (!newIterations.length)
@@ -219,6 +229,22 @@ BuildbotQueue.prototype = {
         }.bind(this));
     },
 
+    _checkForInOrderResult: function(event)
+    {
+        if (this._hasLoadedIterationForInOrderResult)
+            return;
+        var iterationsInOriginalOrder = this.iterations.concat().sort(function(a, b) { return b.id - a.id; });
+        for (var i = 0; i < iterationsInOriginalOrder.length - 1; ++i) {
+            var i1 = iterationsInOriginalOrder[i];
+            var i2 = iterationsInOriginalOrder[i + 1];
+            if (i1.productive && i2.loaded && this.compareIterations(i1, i2) < 0) {
+                this._hasLoadedIterationForInOrderResult = true;
+                return;
+            }
+        }
+        this.loadMoreHistoricalIterations();
+    },
+
     loadAll: function(callback)
     {
         // FIXME: Don't load everything at once, do it incrementally as requested.
@@ -232,25 +258,32 @@ BuildbotQueue.prototype = {
 
             this.sortIterations();
 
+            this._hasLoadedIterationForInOrderResult = true;
+
             callback(this);
         }.bind(this));
     },
 
-    sortIterations: function()
+    compareIterations: function(a, b)
     {
-        function compareIterations(a, b)
-        {
-            var result = b.openSourceRevision - a.openSourceRevision;
-            if (result)
-                return result;
+        var result = b.openSourceRevision - a.openSourceRevision;
+        if (result)
+            return result;
 
-            result = b.internalRevision - a.internalRevision;
-            if (result)
-                return result;
+        result = b.internalRevision - a.internalRevision;
+        if (result)
+            return result;
 
-            return b.id - a.id;
-        }
+        // A loaded iteration may not have revision numbers if it failed early, before svn steps finished.
+        result = b.loaded - a.loaded;
+        if (result)
+            return result;
 
-        this.iterations.sort(compareIterations);
+        return b.id - a.id;
+    },
+
+    sortIterations: function()
+    {
+        this.iterations.sort(this.compareIterations);
     }
 };
index ddfc456..03cc54c 100644 (file)
@@ -1,3 +1,25 @@
+2015-04-13  Alexey Proskuryakov  <ap@apple.com>
+
+        build.webkit.org/dashboard shows obsolete results when builds are substantially out of order
+        https://bugs.webkit.org/show_bug.cgi?id=138630
+
+        Reviewed by Tim Horton.
+
+        Make sure that we always load at least one in order productive iteration.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
+        (BuildbotQueue): Added _hasLoadedIterationForInOrderResult to track whether the queue
+        is done loading at least one iteration that wasn't an out of order build.
+        (BuildbotQueue.prototype.loadMoreHistoricalIterations): Listen for iteration load
+        when that's needed to check for out of order builds.
+        (BuildbotQueue.prototype.update): Ditto.
+        (BuildbotQueue.prototype._checkForInOrderResult): Check if the queue has an in order
+        result, and if it does not, load more iterations.
+        (BuildbotQueue.prototype.loadAll): We have everything loaded, so we certainly have
+        an in order iteration loaded too.
+        (BuildbotQueue.prototype.compareIterations): Extracted from sortIterations(), and
+        corrected to always sort loaded iterations before unloaded ones.
+
 2015-04-10  Brent Fulgham  <bfulgham@apple.com>
 
         Expand test infrastructure to support scrolling tests