Changeset 70409 in webkit
- Timestamp:
- Oct 23, 2010 9:44:57 PM (13 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r70404 r70409 1 2010-10-23 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 EWS never removes invalid patch ids 6 https://bugs.webkit.org/show_bug.cgi?id=48173 7 8 This is just sticking another finger in the dam. 9 However this adds more unit testing which will help 10 us make sure we're always releasing patches once we 11 redesign the release_patch API and call these from 12 a more central place. 13 14 * Scripts/webkitpy/tool/commands/queues.py: 15 * Scripts/webkitpy/tool/commands/queues_unittest.py: 16 * Scripts/webkitpy/tool/mocktool.py: 17 - Added the ability to request invalid patches. 18 Log a warning message to make sure we don't ever have 19 tests use invalid patch fetches by mistake. 20 1 21 2010-10-23 Dan Bernstein <mitz@apple.com> 2 22 -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
r70382 r70409 39 39 from StringIO import StringIO 40 40 41 from webkitpy.common.net.bugzilla import CommitterValidator 41 from webkitpy.common.net.bugzilla import CommitterValidator, Attachment 42 42 from webkitpy.common.net.layouttestresults import path_for_layout_test, LayoutTestResults 43 43 from webkitpy.common.net.statusserver import StatusServer … … 202 202 return self._tool.status_server.update_status(self.name, message, patch, results_file) 203 203 204 def _fetch_next_work_item(self): 205 return self._tool.status_server.next_work_item(self.name) 204 def _next_patch(self): 205 patch_id = self._tool.status_server.next_work_item(self.name) 206 if not patch_id: 207 return None 208 patch = self._tool.bugs.fetch_attachment(patch_id) 209 if not patch: 210 # FIXME: Using a fake patch because release_work_item has the wrong API. 211 # We also don't really need to release the lock (although that's fine), 212 # mostly we just need to remove this bogus patch from our queue. 213 # If for some reason bugzilla is just down, then it will be re-fed later. 214 patch = Attachment({'id': patch_id}, None) 215 self._release_work_item(patch) 216 return None 217 return patch 206 218 207 219 def _release_work_item(self, patch): … … 239 251 240 252 def next_work_item(self): 241 patch_id = self._fetch_next_work_item() 242 if not patch_id: 243 return None 244 return self._tool.bugs.fetch_attachment(patch_id) 253 return self._next_patch() 245 254 246 255 def should_proceed_with_work_item(self, patch): … … 396 405 397 406 def next_work_item(self): 398 patch_id = self._fetch_next_work_item() 399 if not patch_id: 400 return None 401 return self._tool.bugs.fetch_attachment(patch_id) 407 return self._next_patch() 402 408 403 409 def should_proceed_with_work_item(self, patch): -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
r70374 r70409 140 140 141 141 class AbstractPatchQueueTest(CommandsTest): 142 def test_ fetch_next_work_item(self):142 def test_next_patch(self): 143 143 queue = AbstractPatchQueue() 144 144 tool = MockTool() … … 146 146 queue._options = Mock() 147 147 queue._options.port = None 148 self.assertEquals(queue._fetch_next_work_item(), None) 149 tool.status_server = MockStatusServer(work_items=[2, 1, 3]) 150 self.assertEquals(queue._fetch_next_work_item(), 2) 148 self.assertEquals(queue._next_patch(), None) 149 tool.status_server = MockStatusServer(work_items=[2, 197]) 150 expected_stdout = "MOCK: fetch_attachment: 2 is not a known attachment id\n" # A mock-only message to prevent us from making mistakes. 151 expected_stderr = "MOCK: release_work_item: None 2\n" 152 patch_id = OutputCapture().assert_outputs(self, queue._next_patch, [], expected_stdout=expected_stdout, expected_stderr=expected_stderr) 153 self.assertEquals(patch_id, None) # 2 is an invalid patch id 154 self.assertEquals(queue._next_patch().id(), 197) 151 155 152 156 -
trunk/WebKitTools/Scripts/webkitpy/tool/mocktool.py
r70328 r70409 293 293 return self._override_patch 294 294 295 # This could be changed to .get() if we wish to allow failed lookups. 296 attachment_dictionary = self.attachment_cache[attachment_id] 295 attachment_dictionary = self.attachment_cache.get(attachment_id) 296 if not attachment_dictionary: 297 print "MOCK: fetch_attachment: %s is not a known attachment id" % attachment_id 298 return None 297 299 bug = self.fetch_bug(attachment_dictionary["bug_id"]) 298 300 for attachment in bug.attachments(include_obsolete=True): … … 554 556 if not self._work_items: 555 557 return None 556 return self._work_items [0]558 return self._work_items.pop(0) 557 559 558 560 def release_work_item(self, queue_name, patch):
Note: See TracChangeset
for help on using the changeset viewer.