Add links to TestFailures to easily file bugs about failing tests
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 May 2011 18:41:56 +0000 (18:41 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 May 2011 18:41:56 +0000 (18:41 +0000)
Fixes <http://webkit.org/b/61636> <rdar://problem/9514886> TestFailures page should have
links to file bugs for failing tests

Reviewed by David Kilzer.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js:
(Builder.prototype.resultsPageURL): New helper function to return the URL to results.html
for a particular build.
(Builder.prototype._getFailingTests): Use resultsPageURL.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
(ViewController.prototype._displayBuilder): Add links to file bugs about each set of
failures.
(ViewController.prototype._domForBuildName): Use resultsPageURL.
(ViewController.prototype._domForNewBugLink): Added. Creates an element that represents the
new bug link. The bug has a title, description, and URL already filled in for you!

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

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js
Tools/ChangeLog

index d66cf22..5a6be41 100644 (file)
@@ -188,6 +188,10 @@ Builder.prototype = {
         return this.buildbot.resultsDirectoryURL(this.name, buildName);
     },
 
+    resultsPageURL: function(buildName) {
+        return this.resultsDirectoryURL(buildName) + 'results.html';
+    },
+
     _getBuildJSON: function(buildNumber, callback) {
         var cacheKey = 'getBuildJSON_' + buildNumber;
         if (cacheKey in this._cache) {
@@ -254,7 +258,7 @@ Builder.prototype = {
             }
 
             // Find out which tests failed.
-            getResource(self.resultsDirectoryURL(buildName) + 'results.html', function(xhr) {
+            getResource(self.resultsPageURL(buildName), function(xhr) {
                 var root = document.createElement('html');
                 root.innerHTML = xhr.responseText;
 
index 76821f6..863fb65 100644 (file)
@@ -49,18 +49,26 @@ ViewController.prototype = {
         builder.startFetchingBuildHistory(function(history) {
             var list = document.createElement('ol');
             Object.keys(history).forEach(function(buildName, buildIndex, buildNameArray) {
-                if (!Object.keys(history[buildName].tests).length)
+                var failingTestNames = Object.keys(history[buildName].tests);
+                if (!failingTestNames.length)
                     return;
+
+                var passingBuildName;
+                if (buildIndex + 1 < buildNameArray.length)
+                    passingBuildName = buildNameArray[buildIndex + 1];
+
                 var dlItems = [
                     [document.createTextNode('Failed'), self._domForBuildName(builder, buildName)],
                 ];
-                if (buildIndex + 1 < buildNameArray.length)
+                if (passingBuildName)
                     dlItems.push([document.createTextNode('Passed'), self._domForBuildName(builder, buildNameArray[buildIndex + 1])]);
 
                 var item = document.createElement('li');
                 item.appendChild(createDefinitionList(dlItems));
                 list.appendChild(item);
 
+                item.appendChild(self._domForNewBugLink(builder, buildName, passingBuildName, failingTestNames));
+
                 if (history[buildName].tooManyFailures) {
                     var p = document.createElement('p');
                     p.className = 'info';
@@ -141,7 +149,7 @@ ViewController.prototype = {
         buildLink.appendChild(document.createTextNode(parsed.buildNumber));
 
         var resultsLink = document.createElement('a');
-        resultsLink.href = builder.resultsDirectoryURL(buildName) + 'results.html';
+        resultsLink.href = builder.resultsPageURL(buildName);
         resultsLink.appendChild(document.createTextNode('results.html'));
 
         var result = document.createDocumentFragment();
@@ -175,4 +183,64 @@ ViewController.prototype = {
 
         return result;
     },
+
+    _domForNewBugLink: function(tester, failingBuildName, passingBuildName, failingTests) {
+        return document.createDocumentFragment();
+        var parsedFailingBuildName = this._buildbot.parseBuildName(failingBuildName);
+        var regressionRangeString = 'r' + parsedFailingBuildName.revision;
+        if (passingBuildName) {
+            var parsedPassingBuildName = this._buildbot.parseBuildName(passingBuildName);
+            if (parsedFailingBuildName.revision - parsedPassingBuildName.revision > 1)
+                regressionRangeString = 'r' + parsedPassingBuildName.revision + '-' + regressionRangeString;
+        }
+
+        var description = failingTests.join(', ')
+            + (failingTests.length > 1 ? ' have' : ' has') + ' been failing on ' + tester.name
+            + ' since r' + parsedFailingBuildName.revision + '.\n\n';
+
+        if (passingBuildName)
+            description += encodeURI(tester.resultsPageURL(passingBuildName)) + ' passed\n';
+        var failingResultsHTML = tester.resultsPageURL(failingBuildName);
+        description += encodeURI(failingResultsHTML) + ' failed\n';
+
+        // FIXME: When a newly-added test has been failing since its introduction, it isn't really a
+        // "regression". We should use a different title and keywords in that case.
+        // <http://webkit.org/b/61645>
+        var queryParameters = {
+            product: 'WebKit',
+            version: '528+ (Nightly build)',
+            component: 'Tools / Tests',
+            keywords: 'LayoutTestFailure, MakingBotsRed, Regression',
+            short_desc: 'REGRESSION (' + regressionRangeString + '): ' + failingTests.join(', ') + ' failing on ' + tester.name,
+            comment: description,
+            bug_file_loc: failingResultsHTML,
+        };
+
+        if (/Windows/.test(tester.name)) {
+            queryParameters.rep_platform = 'PC';
+            if (/Windows 7/.test(tester.name))
+                queryParameters.op_sys = 'Windows 7';
+            else if (/Windows XP/.test(tester.name))
+                queryParameters.op_sys = 'Windows XP';
+        } else if (/Leopard/.test(tester.name)) {
+            queryParameters.rep_platform = 'Macintosh';
+            if (/SnowLeopard/.test(tester.name))
+                queryParameters.op_sys = 'Mac OS X 10.6';
+            else
+                queryParameters.op_sys = 'Mac OS X 10.5';
+        }
+
+        var encodedParameters = Object.keys(queryParameters).map(function(key) {
+            return key + '=' + encodeURIComponent(queryParameters[key])
+        });
+
+        var link = document.createElement('a');
+        link.href = 'https://bugs.webkit.org/enter_bug.cgi?' + encodedParameters.join('&');
+        link.target = '_blank';
+        link.appendChild(document.createTextNode('File bug for ' + (failingTests.length > 1 ? 'these failures' : 'this failure')));
+
+        var p = document.createElement('p');
+        p.appendChild(link);
+        return p;
+    },
 };
index 55994e3..c60cdc5 100644 (file)
@@ -1,3 +1,24 @@
+2011-05-27  Adam Roben  <aroben@apple.com>
+
+        Add links to TestFailures to easily file bugs about failing tests
+
+        Fixes <http://webkit.org/b/61636> <rdar://problem/9514886> TestFailures page should have
+        links to file bugs for failing tests
+
+        Reviewed by David Kilzer.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js:
+        (Builder.prototype.resultsPageURL): New helper function to return the URL to results.html
+        for a particular build.
+        (Builder.prototype._getFailingTests): Use resultsPageURL.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
+        (ViewController.prototype._displayBuilder): Add links to file bugs about each set of
+        failures.
+        (ViewController.prototype._domForBuildName): Use resultsPageURL.
+        (ViewController.prototype._domForNewBugLink): Added. Creates an element that represents the
+        new bug link. The bug has a title, description, and URL already filled in for you!
+
 2011-05-27  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r87464.