- Revision
- 90153
- Author
- [email protected]
- Date
- 2011-06-30 13:03:33 -0700 (Thu, 30 Jun 2011)
Log Message
Identify revisions that modified failing tests on TestFailures page
Fixes <http://webkit.org/b/63716> TestFailures page should try to infer which commit caused
a failure by looking at commit logs
Reviewed by David Kilzer.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css:
(.existing-bugs-list, .suspect-revisions-list): Made this rule apply to the suspect
revisions list, too.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js:
(Trac): Initialize our memory cache.
(Trac.prototype.getCommitDataForRevisionRange): Added. Fetches the commit log in RSS form,
then parses out the revision number, Trac's idea of the commit title, and the files modified
by the commit. (To get the modified files, we rely on the commit message including a
prepare-ChangeLog-style file list.)
(Trac.prototype.logURL): Added a new formatAsRSS parameter.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities.js:
(removePathExtension): Added. Returns a new string with the last dot and everything after it
removed.
(sorted): Added sortFunction parameter.
(Node.prototype.removeAllChildren): Added. Does what it says.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
(ViewController.prototype._displayBuilder): Updated for change to _domForRegressionRange.
(ViewController.prototype._domForRegressionRange): Changed argument order to match
_domForNewAndExistingBugs. Now takes the list of failing tests and uses it to figure out
which revisions modified the failing tests and displays the suspect revisions in a list.
Modified Paths
Diff
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css (90152 => 90153)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css 2011-06-30 19:40:43 UTC (rev 90152)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css 2011-06-30 20:03:33 UTC (rev 90153)
@@ -48,7 +48,7 @@
margin-bottom: 0;
}
-.existing-bugs-list {
+.existing-bugs-list, .suspect-revisions-list {
font-size: smaller;
}
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js (90152 => 90153)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js 2011-06-30 19:40:43 UTC (rev 90152)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js 2011-06-30 20:03:33 UTC (rev 90153)
@@ -25,6 +25,7 @@
function Trac(baseURL) {
this.baseURL = baseURL;
+ this._cache = {};
}
Trac.prototype = {
@@ -32,13 +33,75 @@
return this.baseURL + 'changeset/' + revision;
},
- logURL: function(path, startRevision, endRevision, showFullCommitLogs) {
+ getCommitDataForRevisionRange: function(path, startRevision, endRevision, callback) {
+ // FIXME: We could try to be smarter and cache individual commits, but in practice we just
+ // get called with the same parameters over and over.
+ var cacheKey = 'getCommitDataForRevisionRange.' + [path, startRevision, endRevision].join('.');
+ if (cacheKey in this._cache) {
+ callback(this._cache[cacheKey]);
+ return;
+ }
+
+ var callbacksCacheKey = 'callbacks.' + cacheKey;
+ if (callbacksCacheKey in this._cache) {
+ this._cache[callbacksCacheKey].push(callback);
+ return;
+ }
+
+ this._cache[callbacksCacheKey] = [callback];
+
+ var self = this;
+
+ function cacheResultsAndCallCallbacks(commits) {
+ self._cache[cacheKey] = commits;
+
+ var callbacks = self._cache[callbacksCacheKey];
+ delete self._cache[callbacksCacheKey];
+
+ callbacks.forEach(function(callback) {
+ callback(commits);
+ });
+ }
+
+ getResource(self.logURL('trunk', startRevision, endRevision, true, true), function(xhr) {
+ var commits = Array.prototype.map.call(xhr.responseXML.getElementsByTagName('item'), function(item) {
+ var title = item.getElementsByTagName('title')[0].textContent;
+ var revision = parseInt(/^Revision (\d+):/.exec(title)[1], 10);
+
+ var container = document.createElement('div');
+ container.innerHTML = item.getElementsByTagName('description')[0].textContent;
+ var listItems = container.querySelectorAll('li');
+ var files = [];
+ for (var i = 0; i < listItems.length; ++i) {
+ var match = /^([^:]+)/.exec(listItems[i].textContent);
+ if (!match)
+ continue;
+ files.push(match[1]);
+ }
+
+ return {
+ revision: revision,
+ title: title,
+ modifiedFiles: files,
+ };
+ });
+
+ cacheResultsAndCallCallbacks(commits);
+ },
+ function(xhr) {
+ cacheResultsAndCallCallbacks([]);
+ });
+ },
+
+ logURL: function(path, startRevision, endRevision, showFullCommitLogs, formatAsRSS) {
var queryParameters = {
rev: endRevision,
stop_rev: startRevision,
};
if (showFullCommitLogs)
queryParameters.verbose = 'on';
+ if (formatAsRSS)
+ queryParameters.format = 'rss';
return addQueryParametersToURL(this.baseURL + 'log/' + path, queryParameters);
},
};
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities.js (90152 => 90153)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities.js 2011-06-30 19:40:43 UTC (rev 90152)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities.js 2011-06-30 20:03:33 UTC (rev 90153)
@@ -103,9 +103,16 @@
return result.join(separator);
}
-function sorted(array) {
+function removePathExtension(string) {
+ var dotIndex = string.lastIndexOf('.');
+ if (dotIndex < 0)
+ return string;
+ return string.substring(0, dotIndex);
+}
+
+function sorted(array, sortFunction) {
var newArray = array.slice();
- newArray.sort();
+ newArray.sort(sortFunction);
return newArray;
}
@@ -135,3 +142,8 @@
for (var i = 0; i < children.length; ++i)
this.appendChild(children[i]);
}
+
+Node.prototype.removeAllChildren = function() {
+ while (this.firstChild)
+ this.removeChild(this.firstChild);
+}
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js (90152 => 90153)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js 2011-06-30 19:40:43 UTC (rev 90152)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js 2011-06-30 20:03:33 UTC (rev 90153)
@@ -93,7 +93,7 @@
if (buildIndex + 1 < buildNameArray.length)
passingBuildName = buildNameArray[buildIndex + 1];
- item.appendChild(self._domForRegressionRange(builder, passingBuildName, buildName));
+ item.appendChild(self._domForRegressionRange(builder, buildName, passingBuildName, failingTestNames));
if (passingBuildName || !stillFetchingData)
item.appendChild(self._domForNewAndExistingBugs(builder, buildName, passingBuildName, failingTestNames));
@@ -168,7 +168,7 @@
});
},
- _domForRegressionRange: function(builder, passingBuildName, failingBuildName) {
+ _domForRegressionRange: function(builder, failingBuildName, passingBuildName, failingTestNames) {
var result = document.createDocumentFragment();
var dlItems = [
@@ -187,12 +187,57 @@
if (firstSuspectRevision === lastSuspectRevision)
return result;
+ var suspectsContainer = document.createElement('div');
+ result.appendChild(suspectsContainer);
+
var link = document.createElement('a');
result.appendChild(link);
link.href = "" firstSuspectRevision, lastSuspectRevision, true);
link.appendChild(document.createTextNode('View regression range in Trac'));
+ suspectsContainer.appendChild(document.createTextNode('Searching for suspect revisions\u2026'));
+
+ // FIXME: Maybe some of this code should go in LayoutTestHistoryAnalyzer, or some other class?
+ var self = this;
+ self._trac.getCommitDataForRevisionRange('trunk', firstSuspectRevision, lastSuspectRevision, function(commits) {
+ var failingTestNamesWithoutExtensions = failingTestNames.map(removePathExtension);
+ var suspectCommits = commits.filter(function(commit) {
+ return commit.modifiedFiles.some(function(file) {
+ return failingTestNamesWithoutExtensions.some(function(testName) {
+ return file.indexOf(testName) >= 0;
+ });
+ });
+ });
+
+ suspectsContainer.removeAllChildren();
+
+ if (!suspectCommits.length)
+ return;
+
+ var title = 'Suspect revision' + (suspectCommits.length > 1 ? 's' : '') + ':';
+ suspectsContainer.appendChild(document.createTextNode(title));
+
+ var list = document.createElement('ul');
+ suspectsContainer.appendChild(list);
+ list.className = 'suspect-revisions-list';
+
+ function compareCommits(a, b) {
+ return b.revision - a.revision;
+ }
+
+ list.appendChildren(sorted(suspectCommits, compareCommits).map(function(commit) {
+ var item = document.createElement('li');
+ var link = document.createElement('a');
+ item.appendChild(link);
+
+ link.href = ""
+ link.appendChild(document.createTextNode(commit.title))
+
+ return item;
+ }));
+ });
+
return result;
},
Modified: trunk/Tools/ChangeLog (90152 => 90153)
--- trunk/Tools/ChangeLog 2011-06-30 19:40:43 UTC (rev 90152)
+++ trunk/Tools/ChangeLog 2011-06-30 20:03:33 UTC (rev 90153)
@@ -1,3 +1,36 @@
+2011-06-30 Adam Roben <[email protected]>
+
+ Identify revisions that modified failing tests on TestFailures page
+
+ Fixes <http://webkit.org/b/63716> TestFailures page should try to infer which commit caused
+ a failure by looking at commit logs
+
+ Reviewed by David Kilzer.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestFailures.css:
+ (.existing-bugs-list, .suspect-revisions-list): Made this rule apply to the suspect
+ revisions list, too.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js:
+ (Trac): Initialize our memory cache.
+ (Trac.prototype.getCommitDataForRevisionRange): Added. Fetches the commit log in RSS form,
+ then parses out the revision number, Trac's idea of the commit title, and the files modified
+ by the commit. (To get the modified files, we rely on the commit message including a
+ prepare-ChangeLog-style file list.)
+ (Trac.prototype.logURL): Added a new formatAsRSS parameter.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities.js:
+ (removePathExtension): Added. Returns a new string with the last dot and everything after it
+ removed.
+ (sorted): Added sortFunction parameter.
+ (Node.prototype.removeAllChildren): Added. Does what it says.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
+ (ViewController.prototype._displayBuilder): Updated for change to _domForRegressionRange.
+ (ViewController.prototype._domForRegressionRange): Changed argument order to match
+ _domForNewAndExistingBugs. Now takes the list of failing tests and uses it to figure out
+ which revisions modified the failing tests and displays the suspect revisions in a list.
+
2011-06-30 Eric Seidel <[email protected]>
Reviewed by Adam Barth.