Add links to regression ranges in Trac to the TestFailures page
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jun 2011 19:36:44 +0000 (19:36 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jun 2011 19:36:44 +0000 (19:36 +0000)
Fixes <http://webkit.org/b/61060> <rdar://problem/9452153> TestFailures page should provide
links to regression ranges in Trac

Reviewed by David Kilzer.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js: Added.
(Trac): This new class represents a particular instance of Trac for a single project.
(Trac.prototype.logURL): Returns the URL that can be used to see the log of the given
repository path between the two specified revisions
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
(ViewController): Added new trac argument.
(ViewController.prototype._displayBuilder): Moved code to create the DOM for the
passed/failed builds from here...
(ViewController.prototype._domForRegressionRange): ...to here. Now also includes a link to
Trac if there are multiple suspect revisions.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html: Pull in
Trac.js and pass a Trac instance for trac.webkit.org to the ViewController.

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

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js [new file with mode: 0644]
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html
Tools/ChangeLog

diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js
new file mode 100644 (file)
index 0000000..a568edd
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+function Trac(baseURL) {
+    this.baseURL = baseURL;
+}
+
+Trac.prototype = {
+    logURL: function(path, startRevision, endRevision) {
+        return addQueryParametersToURL(this.baseURL + 'log/' + path, { rev: endRevision, stop_rev: startRevision });
+    },
+};
index a885bb9..9776ca7 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-function ViewController(buildbot, bugzilla) {
+function ViewController(buildbot, bugzilla, trac) {
     this._buildbot = buildbot;
     this._bugzilla = bugzilla;
+    this._trac = trac;
 
     var self = this;
     addEventListener('load', function() { self.loaded() }, false);
@@ -79,12 +80,7 @@ ViewController.prototype = {
                 if (buildIndex + 1 < buildNameArray.length)
                     passingBuildName = buildNameArray[buildIndex + 1];
 
-                var dlItems = [
-                    [document.createTextNode('Failed'), self._domForBuildName(builder, buildName)],
-                ];
-                if (passingBuildName)
-                    dlItems.push([document.createTextNode('Passed'), self._domForBuildName(builder, buildNameArray[buildIndex + 1])]);
-                item.appendChild(createDefinitionList(dlItems));
+                item.appendChild(self._domForRegressionRange(builder, passingBuildName, buildName));
 
                 if (passingBuildName || !stillFetchingData)
                     item.appendChild(self._domForNewAndExistingBugs(builder, buildName, passingBuildName, failingTestNames));
@@ -145,6 +141,34 @@ ViewController.prototype = {
         });
     },
 
+    _domForRegressionRange: function(builder, passingBuildName, failingBuildName) {
+        var result = document.createDocumentFragment();
+
+        var dlItems = [
+            [document.createTextNode('Failed'), this._domForBuildName(builder, failingBuildName)],
+        ];
+        if (passingBuildName)
+            dlItems.push([document.createTextNode('Passed'), this._domForBuildName(builder, passingBuildName)]);
+        result.appendChild(createDefinitionList(dlItems));
+
+        if (!passingBuildName)
+            return result;
+
+        var firstSuspectRevision = this._buildbot.parseBuildName(passingBuildName).revision + 1;
+        var lastSuspectRevision = this._buildbot.parseBuildName(failingBuildName).revision;
+
+        if (firstSuspectRevision === lastSuspectRevision)
+            return result;
+
+        var link = document.createElement('a');
+        result.appendChild(link);
+
+        link.href = this._trac.logURL('trunk', firstSuspectRevision, lastSuspectRevision);
+        link.appendChild(document.createTextNode('View regression range in Trac'));
+
+        return result;
+    },
+
     _domForBuildName: function(builder, buildName) {
         var parsed = this._buildbot.parseBuildName(buildName);
 
index 5fad98d..9f43cc4 100644 (file)
@@ -31,12 +31,13 @@ THE POSSIBILITY OF SUCH DAMAGE.
     <script src="Buildbot.js"></script>
     <script src="Builder.js"></script>
     <script src="PersistentCache.js"></script>
+    <script src="Trac.js"></script>
     <script src="Utilities.js"></script>
     <script src="ViewController.js"></script>
 
     <script src="WebKitBuildbot.js"></script>
     <script>
-        var viewController = new ViewController(new WebKitBuildbot(), new Bugzilla('https://bugs.webkit.org/'));
+        var viewController = new ViewController(new WebKitBuildbot(), new Bugzilla('https://bugs.webkit.org/'), new Trac('http://trac.webkit.org/'));
     </script>
 </head>
 <body>
index ed30d72..c8c9f99 100644 (file)
@@ -1,3 +1,26 @@
+2011-06-24  Adam Roben  <aroben@apple.com>
+
+        Add links to regression ranges in Trac to the TestFailures page
+
+        Fixes <http://webkit.org/b/61060> <rdar://problem/9452153> TestFailures page should provide
+        links to regression ranges in Trac
+
+        Reviewed by David Kilzer.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js: Added.
+        (Trac): This new class represents a particular instance of Trac for a single project.
+        (Trac.prototype.logURL): Returns the URL that can be used to see the log of the given
+        repository path between the two specified revisions
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
+        (ViewController): Added new trac argument.
+        (ViewController.prototype._displayBuilder): Moved code to create the DOM for the
+        passed/failed builds from here...
+        (ViewController.prototype._domForRegressionRange): ...to here. Now also includes a link to
+        Trac if there are multiple suspect revisions.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html: Pull in
+        Trac.js and pass a Trac instance for trac.webkit.org to the ViewController.
+
 2011-05-17  Nat Duca  <nduca@chromium.org>
 
         Reviewed by James Robinson.