Changeset 91538 in webkit
- Timestamp:
- Jul 21, 2011 5:29:31 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js
r91272 r91538 24 24 */ 25 25 26 function FailingTestsBugForm(bugzilla, t rac, tester, failingBuildName, passingBuildName, failingTests) {26 function FailingTestsBugForm(bugzilla, tester, failingBuildName, passingBuildName, failingTests) { 27 27 TestRelatedBugForm.call(this, bugzilla, tester); 28 28 29 this._trac = trac;30 29 this._failingBuildName = failingBuildName; 31 30 this._passingBuildName = passingBuildName; … … 49 48 endOfFirstSentence = 'started failing on ' + this._tester.name; 50 49 if (firstSuspectRevision === lastSuspectRevision) 51 endOfFirstSentence += ' in r' + firstSuspectRevision + ' <' + t his._trac.changesetURL(firstSuspectRevision) + '>';50 endOfFirstSentence += ' in r' + firstSuspectRevision + ' <' + trac.changesetURL(firstSuspectRevision) + '>'; 52 51 else 53 52 endOfFirstSentence += ' between r' + firstSuspectRevision + ' and r' + lastSuspectRevision + ' (inclusive)'; 54 53 } else 55 endOfFirstSentence = (this._failingTests.length === 1 ? 'has' : 'have') + ' been failing on ' + this._tester.name + ' since at least r' + firstSuspectRevision + ' <' + t his._trac.changesetURL(firstSuspectRevision) + '>';54 endOfFirstSentence = (this._failingTests.length === 1 ? 'has' : 'have') + ' been failing on ' + this._tester.name + ' since at least r' + firstSuspectRevision + ' <' + trac.changesetURL(firstSuspectRevision) + '>'; 56 55 var description; 57 56 if (this._failingTests.length === 1) … … 65 64 } 66 65 if (firstSuspectRevision !== lastSuspectRevision) 67 description += t his._trac.logURL('trunk', firstSuspectRevision, lastSuspectRevision) + '\n\n';66 description += trac.logURL('trunk', firstSuspectRevision, lastSuspectRevision) + '\n\n'; 68 67 if (this._passingBuildName) 69 68 description += this._tester.resultsPageURL(this._passingBuildName) + ' passed\n'; -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js
r91272 r91538 32 32 mockBugzilla.baseURL = '[BUGZILLA BASE URL]'; 33 33 34 var mockTrac = {};35 mockTrac.changesetURL = function(revisionNumber) {36 return '[CHANGESET URL r' + revisionNumber + ']';37 }38 mockTrac.logURL = function(path, startRevision, endRevision) {39 return '[LOG URL ' + path + ', r' + startRevision + ', r' + endRevision + ']';40 }41 42 34 var mockBuildbot = {}; 43 35 mockBuildbot.parseBuildName = function(buildName) { … … 56 48 } 57 49 58 return new FailingTestsBugForm(mockBugzilla, mock Trac, mockBuilder, failingBuildName, passingBuildName, failingTests);50 return new FailingTestsBugForm(mockBugzilla, mockBuilder, failingBuildName, passingBuildName, failingTests); 59 51 } 60 52 … … 71 63 'css1/basic/class_as_selector.html', 72 64 ], 73 expectedDescription: 'css1/basic/class_as_selector.html has been failing on Windows 7 Release (Tests) since at least r10 < [CHANGESET URL r10]>.\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n',65 expectedDescription: 'css1/basic/class_as_selector.html has been failing on Windows 7 Release (Tests) since at least r10 <http://trac.webkit.org/changeset/10>.\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n', 74 66 expectedTitle: 'REGRESSION (r10): css1/basic/class_as_selector.html failing on Windows 7 Release (Tests)', 75 67 }, … … 80 72 'css1/basic/class_as_selector.html', 81 73 ], 82 expectedDescription: 'css1/basic/class_as_selector.html started failing on Windows 7 Release (Tests) in r10 < [CHANGESET URL r10]>.\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r9 (3)] passed\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n',74 expectedDescription: 'css1/basic/class_as_selector.html started failing on Windows 7 Release (Tests) in r10 <http://trac.webkit.org/changeset/10>.\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r9 (3)] passed\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n', 83 75 expectedTitle: 'REGRESSION (r10): css1/basic/class_as_selector.html failing on Windows 7 Release (Tests)', 84 76 }, … … 89 81 'css1/basic/class_as_selector.html', 90 82 ], 91 expectedDescription: 'css1/basic/class_as_selector.html started failing on Windows 7 Release (Tests) between r9 and r10 (inclusive).\n\n [LOG URL trunk, r9, r10]\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r8 (2)] passed\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n',83 expectedDescription: 'css1/basic/class_as_selector.html started failing on Windows 7 Release (Tests) between r9 and r10 (inclusive).\n\nhttp://trac.webkit.org/log/trunk?rev=10&stop_rev=9\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r8 (2)] passed\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n', 92 84 expectedTitle: 'REGRESSION (r8-r10): css1/basic/class_as_selector.html failing on Windows 7 Release (Tests)', 93 85 }, … … 99 91 'fast/css/ex-after-font-variant.html', 100 92 ], 101 expectedDescription: 'css1/basic/class_as_selector.html and fast/css/ex-after-font-variant.html started failing on Windows 7 Release (Tests) between r9 and r10 (inclusive).\n\n [LOG URL trunk, r9, r10]\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r8 (2)] passed\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n',93 expectedDescription: 'css1/basic/class_as_selector.html and fast/css/ex-after-font-variant.html started failing on Windows 7 Release (Tests) between r9 and r10 (inclusive).\n\nhttp://trac.webkit.org/log/trunk?rev=10&stop_rev=9\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r8 (2)] passed\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n', 102 94 expectedTitle: 'REGRESSION (r8-r10): css1/basic/class_as_selector.html, fast/css/ex-after-font-variant.html failing on Windows 7 Release (Tests)', 103 95 }, … … 115 107 'css1/basic/class_as_selector8.html', 116 108 ], 117 expectedDescription: 'The following tests started failing on Windows 7 Release (Tests) between r9 and r10 (inclusive):\n\n css1/basic/class_as_selector1.html\n css1/basic/class_as_selector2.html\n css1/basic/class_as_selector3.html\n css1/basic/class_as_selector4.html\n css1/basic/class_as_selector5.html\n css1/basic/class_as_selector6.html\n css1/basic/class_as_selector7.html\n css1/basic/class_as_selector8.html\n\n [LOG URL trunk, r9, r10]\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r8 (2)] passed\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n',109 expectedDescription: 'The following tests started failing on Windows 7 Release (Tests) between r9 and r10 (inclusive):\n\n css1/basic/class_as_selector1.html\n css1/basic/class_as_selector2.html\n css1/basic/class_as_selector3.html\n css1/basic/class_as_selector4.html\n css1/basic/class_as_selector5.html\n css1/basic/class_as_selector6.html\n css1/basic/class_as_selector7.html\n css1/basic/class_as_selector8.html\n\nhttp://trac.webkit.org/log/trunk?rev=10&stop_rev=9\n\n[RESULTS PAGE URL Windows 7 Release (Tests), r8 (2)] passed\n[RESULTS PAGE URL Windows 7 Release (Tests), r10 (5)] failed\n', 118 110 expectedTitle: 'REGRESSION (r8-r10): 8 css1/basic tests failing on Windows 7 Release (Tests)', 119 111 }, -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js
r90639 r91538 24 24 */ 25 25 26 function Trac(baseURL) { 27 this.baseURL = baseURL; 28 this._cache = {}; 26 var trac = trac || {}; 27 28 (function() { 29 30 function parseCommitData(responseXML) 31 { 32 var commits = Array.prototype.map.call(responseXML.getElementsByTagName('item'), function(item) { 33 var title = item.getElementsByTagName('title')[0].textContent; 34 var revision = parseInt(/^Revision (\d+):/.exec(title)[1], 10); 35 36 var container = document.createElement('div'); 37 container.innerHTML = item.getElementsByTagName('description')[0].textContent; 38 39 return { 40 revision: revision, 41 title: title, 42 // FIXME: This isn't a very high-fidelity reproduction of the commit message, 43 // but it's good enough for our purposes. 44 message: container.innerText, 45 }; 46 }); 47 48 return commits; 29 49 } 30 50 31 Trac.prototype = { 32 changesetURL: function(revision) { 33 return this.baseURL + 'changeset/' + revision; 34 }, 51 var g_cache = new base.AsynchronousCache(function(key, callback) { 52 var explodedKey = key.split('\n'); 35 53 36 getCommitDataForRevisionRange: function(path, startRevision, endRevision, callback) { 37 // FIXME: We could try to be smarter and cache individual commits, but in practice we just 38 // get called with the same parameters over and over. 39 var cacheKey = 'getCommitDataForRevisionRange.' + [path, startRevision, endRevision].join('.'); 40 if (cacheKey in this._cache) { 41 callback(this._cache[cacheKey]); 42 return; 43 } 54 var path = explodedKey[0]; 55 var startRevision = explodedKey[1]; 56 var endRevision = explodedKey[2]; 44 57 45 var callbacksCacheKey = 'callbacks.' + cacheKey; 46 if (callbacksCacheKey in this._cache) { 47 this._cache[callbacksCacheKey].push(callback); 48 return; 49 } 58 var url = trac.logURL(path, startRevision, endRevision, true, true); 50 59 51 this._cache[callbacksCacheKey] = [callback]; 60 $.get(url, function(commitData) { 61 callback(parseCommitData(commitData)); 62 }); 63 }); 52 64 53 var self = this; 65 trac.changesetURL = function(revision) 66 { 67 return config.kTracURL + '/changeset/' + revision; 68 }; 54 69 55 function cacheResultsAndCallCallbacks(commits) { 56 self._cache[cacheKey] = commits; 70 trac.logURL = function(path, startRevision, endRevision, showFullCommitLogs, formatAsRSS) 71 { 72 var queryParameters = { 73 rev: endRevision, 74 stop_rev: startRevision, 75 }; 57 76 58 var callbacks = self._cache[callbacksCacheKey]; 59 delete self._cache[callbacksCacheKey]; 77 if (showFullCommitLogs) 78 queryParameters.verbose = 'on'; 79 if (formatAsRSS) 80 queryParameters.format = 'rss'; 60 81 61 callbacks.forEach(function(callback) { 62 callback(commits); 63 }); 64 } 82 return config.kTracURL + '/log/' + path + '?' + $.param(queryParameters); 83 }; 65 84 66 getResource(self.logURL('trunk', startRevision, endRevision, true, true), function(xhr) { 67 var commits = Array.prototype.map.call(xhr.responseXML.getElementsByTagName('item'), function(item) { 68 var title = item.getElementsByTagName('title')[0].textContent; 69 var revision = parseInt(/^Revision (\d+):/.exec(title)[1], 10); 85 trac.commitDataForRevisionRange = function(path, startRevision, endRevision, callback) 86 { 87 var key = [path, startRevision, endRevision].join('\n'); 88 g_cache.get(key, callback); 89 }; 70 90 71 var container = document.createElement('div'); 72 container.innerHTML = item.getElementsByTagName('description')[0].textContent; 73 74 return { 75 revision: revision, 76 title: title, 77 // FIXME: This isn't a very high-fidelity reproduction of the commit message, 78 // but it's good enough for our purposes. 79 message: container.innerText, 80 }; 81 }); 82 83 cacheResultsAndCallCallbacks(commits); 84 }, 85 function(xhr) { 86 cacheResultsAndCallCallbacks([]); 87 }); 88 }, 89 90 logURL: function(path, startRevision, endRevision, showFullCommitLogs, formatAsRSS) { 91 var queryParameters = { 92 rev: endRevision, 93 stop_rev: startRevision, 94 }; 95 if (showFullCommitLogs) 96 queryParameters.verbose = 'on'; 97 if (formatAsRSS) 98 queryParameters.format = 'rss'; 99 return addQueryParametersToURL(this.baseURL + 'log/' + path, queryParameters); 100 }, 101 }; 91 })(); -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js
r91278 r91538 24 24 */ 25 25 26 function ViewController(buildbot, bugzilla , trac) {26 function ViewController(buildbot, bugzilla) { 27 27 this._buildbot = buildbot; 28 28 this._bugzilla = bugzilla; 29 this._trac = trac;30 29 this._navigationID = 0; 31 30 … … 105 104 106 105 if (passingBuildName || !stillFetchingData) { 107 var bugForm = new FailingTestsBugForm(self._bugzilla, self._trac,builder, buildName, passingBuildName, failingTestNames);106 var bugForm = new FailingTestsBugForm(self._bugzilla, builder, buildName, passingBuildName, failingTestNames); 108 107 item.appendChild(self._domForNewAndExistingBugs(builder, failingTestNames, bugForm)) 109 108 } … … 199 198 result.appendChild(link); 200 199 201 link.href = t his._trac.logURL('trunk', firstSuspectRevision, lastSuspectRevision, true);200 link.href = trac.logURL('trunk', firstSuspectRevision, lastSuspectRevision, true); 202 201 link.appendChild(document.createTextNode('View regression range in Trac')); 203 202 … … 206 205 // FIXME: Maybe some of this code should go in LayoutTestHistoryAnalyzer, or some other class? 207 206 var self = this; 208 self._trac.getCommitDataForRevisionRange('trunk', firstSuspectRevision, lastSuspectRevision, function(commits) {207 trac.getCommitDataForRevisionRange('trunk', firstSuspectRevision, lastSuspectRevision, function(commits) { 209 208 var failingTestNamesWithoutExtensions = failingTestNames.map(removePathExtension); 210 209 var suspectCommits = commits.filter(function(commit) { … … 235 234 item.appendChild(link); 236 235 237 link.href = self._trac.changesetURL(commit.revision);236 link.href = trac.changesetURL(commit.revision); 238 237 link.appendChild(document.createTextNode(commit.title)) 239 238 -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js
r91519 r91538 147 147 }; 148 148 149 base.AsynchronousCache = function(fetch) 150 { 151 this._fetch = fetch; 152 this._dataCache = {}; 153 this._callbackCache = {}; 154 }; 155 156 base.AsynchronousCache.prototype.get = function(key, callback) 157 { 158 var self = this; 159 160 if (self._dataCache[key]) { 161 // FIXME: Consider always calling callback asynchronously. 162 callback(self._dataCache[key]); 163 return; 164 } 165 166 if (key in self._callbackCache) { 167 self._callbackCache[key].push(callback); 168 return; 169 } 170 171 self._callbackCache[key] = [callback]; 172 173 self._fetch.call(null, key, function(data) { 174 self._dataCache[key] = data; 175 176 var callbackList = self._callbackCache[key]; 177 delete self._callbackCache[key]; 178 179 callbackList.forEach(function(cachedCallback) { 180 cachedCallback(data); 181 }); 182 }); 183 }; 184 149 185 })(); -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js
r91519 r91538 30 30 ]; 31 31 32 config.kTracURL = 'http://trac.webkit.org'; 33 32 34 config.kTestNameAttr = 'data-test-name'; 33 35 config.kBuilderNameAttr = 'data-builder-name'; -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html
r91278 r91538 28 28 <head> 29 29 <link rel="stylesheet" href="TestFailures.css"></link> 30 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 31 32 <script src="config.js"></script> 33 <script src="base.js"></script> 34 <script src="Trac.js"></script> 35 30 36 <script src="Utilities.js"></script> 31 37 <script src="NewBugForm.js"></script> … … 43 49 <script src="ORWTResultsParser.js"></script> 44 50 <script src="PersistentCache.js"></script> 45 <script src="Trac.js"></script>46 51 <script src="ViewController.js"></script> 47 52 <script src="WebKitBugzilla.js"></script> 48 53 <script src="WebKitBuildbot.js"></script> 49 54 <script> 50 var viewController = new ViewController(new WebKitBuildbot(), new Bugzilla('https://bugs.webkit.org/') , new Trac('http://trac.webkit.org/'));55 var viewController = new ViewController(new WebKitBuildbot(), new Bugzilla('https://bugs.webkit.org/')); 51 56 </script> 52 57 </head> -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/results.js
r91519 r91538 158 158 } 159 159 160 function ResultsCache() 161 { 162 this._cache = {}; 163 } 164 165 ResultsCache.prototype._fetch = function(key, callback) 166 { 167 var self = this; 168 169 var url = kTestResultsServer + 'testfile?key=' + key; 170 base.jsonp(url, function (resultsTree) { 171 self._cache[key] = resultsTree; 172 callback(resultsTree); 173 }); 174 }; 175 176 // Warning! This function can call callback either synchronously or asynchronously. 177 // FIXME: Consider using setTimeout to make this method always asynchronous. 178 ResultsCache.prototype.get = function(key, callback) 179 { 180 if (this._cache[key]) { 181 callback(this._cache[key]); 182 return; 183 } 184 this._fetch(key, callback); 185 }; 186 187 var g_resultsCache = new ResultsCache(); 160 var g_resultsCache = new base.AsynchronousCache(function(key, callback) { 161 base.jsonp(kTestResultsServer + 'testfile?key=' + key, callback); 162 }); 188 163 189 164 function anyIsFailure(resultsList) -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html
r91524 r91538 12 12 <h2 id="qunit-userAgent"></h2> 13 13 <ol id="qunit-tests"></ol> 14 15 <script src="config.js"></script> 16 <script src="base.js"></script> 17 <script src="base_unittests.js"></script> 18 <script src="Trac.js"></script> 19 <script src="trac_unittests.js"></script> 20 <script src="checkout.js"></script> 21 <script src="checkout_unittests.js"></script> 22 <script src="results.js"></script> 23 <script src="results_unittests.js"></script> 24 <script src="ui.js"></script> 25 <script src="ui_unittests.js"></script> 26 14 27 <!-- FIXME: We should have tests for these files! --> 15 28 <script src="Bugzilla.js"></script> … … 40 53 <script src="Builder_unittests.js"></script> 41 54 42 <script src="config.js"></script>43 <script src="base.js"></script>44 <script src="base_unittests.js"></script>45 <script src="checkout.js"></script>46 <script src="checkout_unittests.js"></script>47 <script src="results.js"></script>48 <script src="results_unittests.js"></script>49 <script src="ui.js"></script>50 <script src="ui_unittests.js"></script>51 55 </body> 52 56 </html> -
trunk/Tools/ChangeLog
r91529 r91538 1 2011-07-21 Adam Barth <abarth@webkit.org> 2 3 Refactor Trac.js for use in garden-o-matic 4 https://bugs.webkit.org/show_bug.cgi?id=64998 5 6 Reviewed by Adam Roben. 7 8 This patch refactors Trac.js to match the architecture and style of 9 garden-o-matic. I've also factored AsynchronousCache out of Trac (and 10 moved it to base) because it was redundant with some other code we 11 already had. 12 13 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js: 14 (FailingTestsBugForm): 15 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js: 16 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Trac.js: 17 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js: 18 (ViewController.prototype._displayBuilder.start): 19 (ViewController.prototype._displayBuilder): 20 (ViewController.prototype._domForRegressionRange.trac.getCommitDataForRevisionRange): 21 (ViewController.prototype._domForRegressionRange): 22 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js: 23 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js: 24 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html: 25 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/results.js: 26 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html: 27 1 28 2011-07-21 Ojan Vafai <ojan@chromium.org> 2 29
Note: See TracChangeset
for help on using the changeset viewer.