Diff
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js (89837 => 89838)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js 2011-06-27 18:05:54 UTC (rev 89837)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js 2011-06-27 18:27:33 UTC (rev 89838)
@@ -146,54 +146,6 @@
});
},
- /*
- * Preiodically calls callback until all current failures have been explained. Callback is
- * passed an object like the following:
- * {
- * 'r12347 (681)': {
- * 'tooManyFailures': false,
- * 'tests': {
- * 'css1/basic/class_as_selector2.html': 'fail',
- * },
- * },
- * 'r12346 (680)': {
- * 'tooManyFailures': false,
- * 'tests': {},
- * },
- * 'r12345 (679)': {
- * 'tooManyFailures': false,
- * 'tests': {
- * 'css1/basic/class_as_selector.html': 'crash',
- * },
- * },
- * },
- * Each build contains just the failures that a) are still occuring on the bots, and b) were new
- * in that build.
- */
- startFetchingBuildHistory: function(callback) {
- var cacheKey = '_startFetchingBuildHistory';
- if (!(cacheKey in this._cache))
- this._cache[cacheKey] = {};
-
- var history = this._cache[cacheKey];
-
- var self = this;
- self._getBuildNames(function(buildNames) {
- function inner(buildIndex) {
- self._incorporateBuildHistory(buildNames, buildIndex, history, function(callAgain) {
- var nextIndex = buildIndex + 1;
- if (nextIndex >= buildNames.length)
- callAgain = false;
- callback(history, callAgain);
- if (!callAgain)
- return;
- setTimeout(function() { inner(nextIndex) }, 0);
- });
- }
- inner(0);
- });
- },
-
resultsDirectoryURL: function(buildName) {
return this.buildbot.resultsDirectoryURL(this.name, buildName);
},
@@ -217,7 +169,7 @@
});
},
- _getBuildNames: function(callback) {
+ getBuildNames: function(callback) {
var cacheKey = '_getBuildNames';
if (cacheKey in this._cache) {
callback(this._cache[cacheKey]);
@@ -240,117 +192,4 @@
callback(buildNames);
});
},
-
- _getFailingTests: function(buildName, callback, errorCallback) {
- var cacheKey = this.name + '__getFailingTests_' + buildName;
- if (PersistentCache.contains(cacheKey)) {
- callback(PersistentCache.get(cacheKey));
- return;
- }
-
- var tests = {};
-
- var parsedBuildName = this.buildbot.parseBuildName(buildName);
-
- // http://webkit.org/b/62380 was fixed in r89610.
- var resultsHTMLSupportsTooManyFailuresInfo = parsedBuildName.revision >= 89610;
-
- var self = this;
-
- function fetchAndParseResultsHTMLAndCallCallback(callback, tooManyFailures) {
- getResource(self.resultsPageURL(buildName), function(xhr) {
- var root = document.createElement('html');
- root.innerHTML = xhr.responseText;
-
- if (resultsHTMLSupportsTooManyFailuresInfo)
- tooManyFailures = root.getElementsByClassName('stopped-running-early-message').length > 0;
-
- function testsForResultTable(regex) {
- var paragraph = Array.prototype.findFirst.call(root.querySelectorAll('p'), function(paragraph) {
- return regex.test(paragraph.innerText);
- });
- if (!paragraph)
- return [];
- var table = paragraph.nextElementSibling;
- console.assert(table.nodeName === 'TABLE');
- return Array.prototype.map.call(table.querySelectorAll('td:first-child > a'), function(elem) {
- return elem.innerText;
- });
- }
-
- testsForResultTable(/did not match expected results/).forEach(function(name) {
- tests[name] = 'fail';
- });
- testsForResultTable(/timed out/).forEach(function(name) {
- tests[name] = 'timeout';
- });
- testsForResultTable(/tool to crash/).forEach(function(name) {
- tests[name] = 'crash';
- });
- testsForResultTable(/Web process to crash/).forEach(function(name) {
- tests[name] = 'webprocess crash';
- });
-
- PersistentCache.set(cacheKey, tests);
- callback(tests, tooManyFailures);
- },
- function(xhr) {
- // We failed to fetch results.html. run-webkit-tests must have aborted early.
- PersistentCache.set(cacheKey, tests);
- errorCallback(tests, tooManyFailures);
- });
- }
-
- if (resultsHTMLSupportsTooManyFailuresInfo) {
- fetchAndParseResultsHTMLAndCallCallback(callback, false);
- return;
- }
-
- self.getNumberOfFailingTests(parsedBuildName.buildNumber, function(failingTestCount, tooManyFailures) {
- if (failingTestCount < 0) {
- // The number of failing tests couldn't be determined.
- PersistentCache.set(cacheKey, tests);
- errorCallback(tests, tooManyFailures);
- return;
- }
-
- if (!failingTestCount) {
- // All tests passed.
- PersistentCache.set(cacheKey, tests);
- callback(tests, tooManyFailures);
- return;
- }
-
- // Find out which tests failed.
- fetchAndParseResultsHTMLAndCallCallback(callback, tooManyFailures);
- });
- },
-
- _incorporateBuildHistory: function(buildNames, buildIndex, history, callback) {
- var previousBuildName = Object.keys(history).last();
- var nextBuildName = buildNames[buildIndex];
-
- this._getFailingTests(nextBuildName, function(tests, tooManyFailures) {
- history[nextBuildName] = {
- tooManyFailures: tooManyFailures,
- tests: {},
- };
-
- for (var testName in tests) {
- if (previousBuildName) {
- if (!(testName in history[previousBuildName].tests))
- continue;
- delete history[previousBuildName].tests[testName];
- }
- history[nextBuildName].tests[testName] = tests[testName];
- }
-
- callback(Object.keys(history[nextBuildName].tests).length);
- },
- function(tests) {
- // Some tests failed, but we couldn't fetch results.html (perhaps because the test
- // run aborted early for some reason). Just skip this build entirely.
- callback(true);
- });
- },
};
Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js (0 => 89838)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js 2011-06-27 18:27:33 UTC (rev 89838)
@@ -0,0 +1,108 @@
+/*
+ * 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 LayoutTestHistoryAnalyzer(builder) {
+ this._builder = builder;
+ this._cache = {};
+ this._loader = new LayoutTestResultsLoader(builder);
+}
+
+LayoutTestHistoryAnalyzer.prototype = {
+ /*
+ * Preiodically calls callback until all current failures have been explained. Callback is
+ * passed an object like the following:
+ * {
+ * 'r12347 (681)': {
+ * 'tooManyFailures': false,
+ * 'tests': {
+ * 'css1/basic/class_as_selector2.html': 'fail',
+ * },
+ * },
+ * 'r12346 (680)': {
+ * 'tooManyFailures': false,
+ * 'tests': {},
+ * },
+ * 'r12345 (679)': {
+ * 'tooManyFailures': false,
+ * 'tests': {
+ * 'css1/basic/class_as_selector.html': 'crash',
+ * },
+ * },
+ * },
+ * Each build contains just the failures that a) are still occuring on the bots, and b) were new
+ * in that build.
+ */
+ start: function(callback) {
+ var cacheKey = '_startFetchingBuildHistory';
+ if (!(cacheKey in this._cache))
+ this._cache[cacheKey] = {};
+
+ var history = this._cache[cacheKey];
+
+ var self = this;
+ self._builder.getBuildNames(function(buildNames) {
+ function inner(buildIndex) {
+ self._incorporateBuildHistory(buildNames, buildIndex, history, function(callAgain) {
+ var nextIndex = buildIndex + 1;
+ if (nextIndex >= buildNames.length)
+ callAgain = false;
+ callback(history, callAgain);
+ if (!callAgain)
+ return;
+ setTimeout(function() { inner(nextIndex) }, 0);
+ });
+ }
+ inner(0);
+ });
+ },
+
+ _incorporateBuildHistory: function(buildNames, buildIndex, history, callback) {
+ var previousBuildName = Object.keys(history).last();
+ var nextBuildName = buildNames[buildIndex];
+
+ this._loader.start(nextBuildName, function(tests, tooManyFailures) {
+ history[nextBuildName] = {
+ tooManyFailures: tooManyFailures,
+ tests: {},
+ };
+
+ for (var testName in tests) {
+ if (previousBuildName) {
+ if (!(testName in history[previousBuildName].tests))
+ continue;
+ delete history[previousBuildName].tests[testName];
+ }
+ history[nextBuildName].tests[testName] = tests[testName];
+ }
+
+ callback(Object.keys(history[nextBuildName].tests).length);
+ },
+ function(tests) {
+ // Some tests failed, but we couldn't fetch results.html (perhaps because the test
+ // run aborted early for some reason). Just skip this build entirely.
+ callback(true);
+ });
+ },
+};
Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestResultsLoader.js (0 => 89838)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestResultsLoader.js (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestResultsLoader.js 2011-06-27 18:27:33 UTC (rev 89838)
@@ -0,0 +1,115 @@
+/*
+ * 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 LayoutTestResultsLoader(builder) {
+ this._builder = builder;
+}
+
+LayoutTestResultsLoader.prototype = {
+ start: function(buildName, callback, errorCallback) {
+ var cacheKey = 'LayoutTestResultsLoader.' + this._builder.name + '.' + buildName;
+ if (PersistentCache.contains(cacheKey)) {
+ callback(PersistentCache.get(cacheKey));
+ return;
+ }
+
+ var tests = {};
+
+ var parsedBuildName = this._builder.buildbot.parseBuildName(buildName);
+
+ // http://webkit.org/b/62380 was fixed in r89610.
+ var resultsHTMLSupportsTooManyFailuresInfo = parsedBuildName.revision >= 89610;
+
+ var self = this;
+
+ function fetchAndParseResultsHTMLAndCallCallback(callback, tooManyFailures) {
+ getResource(self._builder.resultsPageURL(buildName), function(xhr) {
+ var root = document.createElement('html');
+ root.innerHTML = xhr.responseText;
+
+ if (resultsHTMLSupportsTooManyFailuresInfo)
+ tooManyFailures = root.getElementsByClassName('stopped-running-early-message').length > 0;
+
+ function testsForResultTable(regex) {
+ var paragraph = Array.prototype.findFirst.call(root.querySelectorAll('p'), function(paragraph) {
+ return regex.test(paragraph.innerText);
+ });
+ if (!paragraph)
+ return [];
+ var table = paragraph.nextElementSibling;
+ console.assert(table.nodeName === 'TABLE');
+ return Array.prototype.map.call(table.querySelectorAll('td:first-child > a'), function(elem) {
+ return elem.innerText;
+ });
+ }
+
+ testsForResultTable(/did not match expected results/).forEach(function(name) {
+ tests[name] = 'fail';
+ });
+ testsForResultTable(/timed out/).forEach(function(name) {
+ tests[name] = 'timeout';
+ });
+ testsForResultTable(/tool to crash/).forEach(function(name) {
+ tests[name] = 'crash';
+ });
+ testsForResultTable(/Web process to crash/).forEach(function(name) {
+ tests[name] = 'webprocess crash';
+ });
+
+ PersistentCache.set(cacheKey, tests);
+ callback(tests, tooManyFailures);
+ },
+ function(xhr) {
+ // We failed to fetch results.html. run-webkit-tests must have aborted early.
+ PersistentCache.set(cacheKey, tests);
+ errorCallback(tests, tooManyFailures);
+ });
+ }
+
+ if (resultsHTMLSupportsTooManyFailuresInfo) {
+ fetchAndParseResultsHTMLAndCallCallback(callback, false);
+ return;
+ }
+
+ self._builder.getNumberOfFailingTests(parsedBuildName.buildNumber, function(failingTestCount, tooManyFailures) {
+ if (failingTestCount < 0) {
+ // The number of failing tests couldn't be determined.
+ PersistentCache.set(cacheKey, tests);
+ errorCallback(tests, tooManyFailures);
+ return;
+ }
+
+ if (!failingTestCount) {
+ // All tests passed.
+ PersistentCache.set(cacheKey, tests);
+ callback(tests, tooManyFailures);
+ return;
+ }
+
+ // Find out which tests failed.
+ fetchAndParseResultsHTMLAndCallCallback(callback, tooManyFailures);
+ });
+ },
+};
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js (89837 => 89838)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js 2011-06-27 18:05:54 UTC (rev 89837)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js 2011-06-27 18:27:33 UTC (rev 89838)
@@ -48,7 +48,7 @@
_displayBuilder: function(builder) {
var self = this;
- builder.startFetchingBuildHistory(function(history, stillFetchingData) {
+ (new LayoutTestHistoryAnalyzer(builder)).start(function(history, stillFetchingData) {
var list = document.createElement('ol');
list.id = 'failure-history';
Object.keys(history).forEach(function(buildName, buildIndex, buildNameArray) {
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html (89837 => 89838)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html 2011-06-27 18:05:54 UTC (rev 89837)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html 2011-06-27 18:27:33 UTC (rev 89838)
@@ -30,6 +30,8 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Tools/ChangeLog (89837 => 89838)
--- trunk/Tools/ChangeLog 2011-06-27 18:05:54 UTC (rev 89837)
+++ trunk/Tools/ChangeLog 2011-06-27 18:27:33 UTC (rev 89838)
@@ -1,3 +1,33 @@
+2011-06-26 Adam Roben <[email protected]>
+
+ Move some inappropriate code out of Builder
+
+ Fixes <http://webkit.org/b/63406> TestFailure page's Builder class has a bunch of code that
+ isn't really about a builder
+
+ Reviewed by Anders Carlsson.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Builder.js:
+ (Builder.prototype.getBuildNames): Renamed from _getBuildNames, since it now needs to be
+ called by other objects.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestHistoryAnalyzer.js:
+ Added. Code came from Builder.
+ (LayoutTestHistoryAnalyzer):
+ (LayoutTestHistoryAnalyzer.prototype.start):
+ (LayoutTestHistoryAnalyzer.prototype._incorporateBuildHistory):
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/LayoutTestResultsLoader.js:
+ Added. Code came from Builder.
+ (LayoutTestResultsLoader):
+ (LayoutTestResultsLoader.prototype.start):
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
+ (ViewController.prototype._displayBuilder): Changed to use LayoutTestHistoryAnalyzer.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html: Pull in new
+ scripts.
+
2011-05-17 Nat Duca <[email protected]>
Reviewed by James Robinson.