| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 var controllers = controllers || {}; | 26 var controllers = controllers || {}; |
| 27 | 27 |
| 28 (function(){ | 28 (function(){ |
| 29 | 29 |
| 30 var kCheckoutUnavailableMessage = 'Failed! Garden-o-matic needs a local server t
o modify your working copy. Please run "webkit-patch garden-o-matic" start the l
ocal server.'; | 30 var kCheckoutUnavailableMessage = 'Failed! Garden-o-matic needs a local server t
o modify your working copy. Please run "webkit-patch garden-o-matic" start the l
ocal server.'; |
| 31 | 31 |
| 32 // FIXME: Where should this function go? | |
| 33 function rebaselineWithStatusUpdates(failureInfoList, resultsByTest) | |
| 34 { | |
| 35 var statusView = new ui.StatusArea('Rebaseline'); | |
| 36 var id = statusView.newId(); | |
| 37 | |
| 38 var failuresToRebaseline = []; | |
| 39 var testNamesLogged = []; | |
| 40 failureInfoList.forEach(function(failureInfo) { | |
| 41 if (isAnyReftest(failureInfo.testName, resultsByTest)) { | |
| 42 if (testNamesLogged.indexOf(failureInfo.testName) == -1) { | |
| 43 statusView.addMessage(id, failureInfo.testName + ' is a ref test
, skipping'); | |
| 44 testNamesLogged.push(failureInfo.testName); | |
| 45 } | |
| 46 } else { | |
| 47 failuresToRebaseline.push(failureInfo); | |
| 48 if (testNamesLogged.indexOf(failureInfo.testName) == -1) { | |
| 49 statusView.addMessage(id, 'Rebaselining ' + failureInfo.testName
+ '...'); | |
| 50 testNamesLogged.push(failureInfo.testName); | |
| 51 } | |
| 52 } | |
| 53 }); | |
| 54 | |
| 55 if (failuresToRebaseline.length) { | |
| 56 // FIXME: checkout.rebaseline() accepts only 3 arguments, we pass 5. | |
| 57 checkout.rebaseline(failuresToRebaseline, function(response) { | |
| 58 try { | |
| 59 var json = JSON.parse(response); | |
| 60 if (!json.result_code) { | |
| 61 statusView.addFinalMessage(id, 'Rebaseline done! Please comm
it locally and land with "git cl dcommit".'); | |
| 62 } else { | |
| 63 statusView.addMessage(id, 'Rebaseline failed (code=' + json.
result_code + ')!'); | |
| 64 statusView.addFinalMessage(id, json.output); | |
| 65 } | |
| 66 } catch (e) { | |
| 67 statusView.addFinalMessage(id, 'Invalid response received: "' +
response + '"'); | |
| 68 } | |
| 69 }, function(failureInfo) { | |
| 70 statusView.addMessage(id, failureInfo.testName + ' on ' + ui.display
NameForBuilder(failureInfo.builderName)); | |
| 71 }, function() { | |
| 72 statusView.addFinalMessage(id, kCheckoutUnavailableMessage); | |
| 73 }, function(failureInfo) { | |
| 74 statusView.addMessage(id, 'Skipping rebaseline for ' + failureInfo.t
estName + ' on ' + ui.displayNameForBuilder(failureInfo.builderName) + ' because
we only rebaseline from release bots.'); | |
| 75 }); | |
| 76 } else { | |
| 77 statusView.addFinalMessage(id, 'No non-reftests left to rebaseline!') | |
| 78 } | |
| 79 } | |
| 80 | |
| 81 // FIXME: This is duplicated from ui/results.js :(. | 32 // FIXME: This is duplicated from ui/results.js :(. |
| 82 function isAnyReftest(testName, resultsByTest) | 33 function isAnyReftest(testName, resultsByTest) |
| 83 { | 34 { |
| 84 return Object.keys(resultsByTest[testName]).map(function(builder) { | 35 return Object.keys(resultsByTest[testName]).map(function(builder) { |
| 85 return resultsByTest[testName][builder]; | 36 return resultsByTest[testName][builder]; |
| 86 }).some(function(resultNode) { | 37 }).some(function(resultNode) { |
| 87 return resultNode.reftest_type && resultNode.reftest_type.length; | 38 return resultNode.reftest_type && resultNode.reftest_type.length; |
| 88 }); | 39 }); |
| 89 } | 40 } |
| 90 | 41 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 109 init: function(view, resultsByTest) | 60 init: function(view, resultsByTest) |
| 110 { | 61 { |
| 111 this._view = view; | 62 this._view = view; |
| 112 this._resultsByTest = resultsByTest; | 63 this._resultsByTest = resultsByTest; |
| 113 this._view.setResultsByTest(resultsByTest); | 64 this._view.setResultsByTest(resultsByTest); |
| 114 | 65 |
| 115 this._view.firstResult(); | 66 this._view.firstResult(); |
| 116 | 67 |
| 117 $(this._view).bind('next', this.onNext.bind(this)); | 68 $(this._view).bind('next', this.onNext.bind(this)); |
| 118 $(this._view).bind('previous', this.onPrevious.bind(this)); | 69 $(this._view).bind('previous', this.onPrevious.bind(this)); |
| 119 $(this._view).bind('rebaseline', this.onRebaseline.bind(this)); | |
| 120 $(this._view).bind('expectfailure', this.onUpdateExpectations.bind(this)
); | 70 $(this._view).bind('expectfailure', this.onUpdateExpectations.bind(this)
); |
| 121 }, | 71 }, |
| 122 onNext: function() | 72 onNext: function() |
| 123 { | 73 { |
| 124 this._view.nextResult(); | 74 this._view.nextResult(); |
| 125 }, | 75 }, |
| 126 onPrevious: function() | 76 onPrevious: function() |
| 127 { | 77 { |
| 128 this._view.previousResult(); | 78 this._view.previousResult(); |
| 129 }, | 79 }, |
| 130 _failureInfoList: function() | 80 _failureInfoList: function() |
| 131 { | 81 { |
| 132 var testName = this._view.currentTestName(); | 82 var testName = this._view.currentTestName(); |
| 133 return Object.keys(this._resultsByTest[testName]).map(function(builderNa
me) { | 83 return Object.keys(this._resultsByTest[testName]).map(function(builderNa
me) { |
| 134 return results.failureInfoForTestAndBuilder(this._resultsByTest, tes
tName, builderName); | 84 return results.failureInfoForTestAndBuilder(this._resultsByTest, tes
tName, builderName); |
| 135 }.bind(this)); | 85 }.bind(this)); |
| 136 }, | 86 }, |
| 137 onRebaseline: function() | |
| 138 { | |
| 139 rebaselineWithStatusUpdates(this._failureInfoList(), this._resultsByTest
); | |
| 140 this._view.nextTest(); | |
| 141 }, | |
| 142 onUpdateExpectations: function() | 87 onUpdateExpectations: function() |
| 143 { | 88 { |
| 144 updateExpectationsWithStatusUpdates(this._failureInfoList()); | 89 updateExpectationsWithStatusUpdates(this._failureInfoList()); |
| 145 } | 90 } |
| 146 }); | 91 }); |
| 147 | 92 |
| 148 controllers.ExpectedFailures = base.extends(Object, { | 93 controllers.ExpectedFailures = base.extends(Object, { |
| 149 init: function(model, view, delegate) | 94 init: function(model, view, delegate) |
| 150 { | 95 { |
| 151 this._model = model; | 96 this._model = model; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 update: function(failureAnalysis) | 141 update: function(failureAnalysis) |
| 197 { | 142 { |
| 198 var key = this._keyFor(failureAnalysis); | 143 var key = this._keyFor(failureAnalysis); |
| 199 var failure = this._testFailures.get(key); | 144 var failure = this._testFailures.get(key); |
| 200 if (!failure) { | 145 if (!failure) { |
| 201 failure = this._createFailureView(failureAnalysis); | 146 failure = this._createFailureView(failureAnalysis); |
| 202 this._view.add(failure); | 147 this._view.add(failure); |
| 203 $(failure).bind('examine', function() { | 148 $(failure).bind('examine', function() { |
| 204 this.onExamine(failure); | 149 this.onExamine(failure); |
| 205 }.bind(this)); | 150 }.bind(this)); |
| 206 $(failure).bind('rebaseline', function() { | |
| 207 this.onRebaseline(failure); | |
| 208 }.bind(this)); | |
| 209 $(failure).bind('expectfailure', function() { | 151 $(failure).bind('expectfailure', function() { |
| 210 this.onUpdateExpectations(failure); | 152 this.onUpdateExpectations(failure); |
| 211 }.bind(this)); | 153 }.bind(this)); |
| 212 } | 154 } |
| 213 failure.addFailureAnalysis(failureAnalysis); | 155 failure.addFailureAnalysis(failureAnalysis); |
| 214 this._testFailures.update(key, failure); | 156 this._testFailures.update(key, failure); |
| 215 return failure; | 157 return failure; |
| 216 }, | 158 }, |
| 217 purge: function() { | 159 purge: function() { |
| 218 this._testFailures.purge(function(failure) { | 160 this._testFailures.purge(function(failure) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 235 return testNameList.indexOf(key) != -1; | 177 return testNameList.indexOf(key) != -1; |
| 236 }); | 178 }); |
| 237 | 179 |
| 238 var controller = new controllers.ResultsDetails(resultsView, failuresByT
est); | 180 var controller = new controllers.ResultsDetails(resultsView, failuresByT
est); |
| 239 this._delegate.showResults(resultsView); | 181 this._delegate.showResults(resultsView); |
| 240 }, | 182 }, |
| 241 _toFailureInfoList: function(failures) | 183 _toFailureInfoList: function(failures) |
| 242 { | 184 { |
| 243 return base.flattenArray(failures.testNameList().map(model.unexpectedFai
lureInfoForTestName)); | 185 return base.flattenArray(failures.testNameList().map(model.unexpectedFai
lureInfoForTestName)); |
| 244 }, | 186 }, |
| 245 onRebaseline: function(failures) | |
| 246 { | |
| 247 var testNameList = failures.testNameList(); | |
| 248 var failuresByTest = base.filterDictionary( | |
| 249 this._resultsFilter(this._model.resultsByBuilder), | |
| 250 function(key) { | |
| 251 return testNameList.indexOf(key) != -1; | |
| 252 }); | |
| 253 | |
| 254 rebaselineWithStatusUpdates(this._toFailureInfoList(failures), failuresB
yTest); | |
| 255 }, | |
| 256 onUpdateExpectations: function(failures) | 187 onUpdateExpectations: function(failures) |
| 257 { | 188 { |
| 258 updateExpectationsWithStatusUpdates(this._toFailureInfoList(failures)); | 189 updateExpectationsWithStatusUpdates(this._toFailureInfoList(failures)); |
| 259 } | 190 } |
| 260 }); | 191 }); |
| 261 | 192 |
| 262 controllers.UnexpectedFailures = base.extends(FailureStreamController, { | 193 controllers.UnexpectedFailures = base.extends(FailureStreamController, { |
| 263 _resultsFilter: results.unexpectedFailuresByTest, | 194 _resultsFilter: results.unexpectedFailuresByTest, |
| 264 | 195 |
| 265 _impliedFirstFailingRevision: function(failureAnalysis) | 196 _impliedFirstFailingRevision: function(failureAnalysis) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 this._notification = new ui.notifications.BuildersFailing(this._mess
age); | 255 this._notification = new ui.notifications.BuildersFailing(this._mess
age); |
| 325 this._view.add(this._notification); | 256 this._view.add(this._notification); |
| 326 } | 257 } |
| 327 // FIXME: We should provide regression ranges for the failing builders. | 258 // FIXME: We should provide regression ranges for the failing builders. |
| 328 // This doesn't seem to happen often enough to worry too much about that
, however. | 259 // This doesn't seem to happen often enough to worry too much about that
, however. |
| 329 this._notification.setFailingBuilders(failuresList); | 260 this._notification.setFailingBuilders(failuresList); |
| 330 } | 261 } |
| 331 }); | 262 }); |
| 332 | 263 |
| 333 })(); | 264 })(); |
| OLD | NEW |