Changeset 56602 in webkit
- Timestamp:
- Mar 25, 2010 10:42:55 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r56601 r56602 1 2010-03-25 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Add webkit-patch lkgr for finding last known good revision 6 https://bugs.webkit.org/show_bug.cgi?id=36626 7 8 This is rather slow for now because the command 9 has to compute this information from the buildbot. 10 A better long-term solution would be to have a server 11 somewhere store a pre-computed LKGR and then any 12 script (like webkit-patch) could just fetch it. 13 14 * Scripts/webkitpy/common/net/buildbot.py: 15 * Scripts/webkitpy/tool/commands/queries.py: 16 1 17 2010-03-25 Adam Barth <abarth@webkit.org> 2 18 -
trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot.py
r56544 r56602 29 29 # WebKit's Python module for interacting with WebKit's buildbot 30 30 31 import operator 31 32 import re 32 33 import urllib … … 371 372 revision_to_failing_bots[revision] = failing_bots 372 373 return revision_to_failing_bots 374 375 # FIXME: This is a hack around lack of Builder.latest_build() support 376 def _latest_builds_from_builders(self, only_core_builders=True): 377 builder_statuses = self.core_builder_statuses() if only_core_builders else self.builder_statuses() 378 return [self.builder_with_name(status["name"]).build(status["build_number"]) for status in builder_statuses] 379 380 def _build_at_or_before_revision(self, build, revision): 381 while build: 382 if build.revision() <= revision: 383 return build 384 build = build.previous_build() 385 386 def last_green_revision(self, only_core_builders=True): 387 builds = self._latest_builds_from_builders(only_core_builders) 388 target_revision = builds[0].revision() 389 # An alternate way to do this would be to start at one revision and walk backwards 390 # checking builder.build_for_revision, however build_for_revision is very slow on first load. 391 while True: 392 # Make builds agree on revision 393 builds = [self._build_at_or_before_revision(build, target_revision) for build in builds] 394 if None in builds: # One of the builds failed to load from the server. 395 return None 396 min_revision = min(map(lambda build: build.revision(), builds)) 397 if min_revision != target_revision: 398 target_revision = min_revision 399 continue # Builds don't all agree on revision, keep searching 400 # Check to make sure they're all green 401 all_are_green = reduce(operator.and_, map(lambda build: build.is_green(), builds)) 402 if not all_are_green: 403 target_revision -= 1 404 continue 405 return min_revision -
trunk/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py
r56508 r56602 320 320 self.assertEqual(self._expected_files, files) 321 321 322 # Revision, is_green 323 # Ordered from newest (highest number) to oldest. 324 fake_builder1 = [ 325 [2, False], 326 [1, True], 327 ] 328 fake_builder2 = [ 329 [2, False], 330 [1, True], 331 ] 332 fake_builders = [ 333 fake_builder1, 334 fake_builder2, 335 ] 336 def _build_from_fake(self, fake_builder, index): 337 if index >= len(fake_builder): 338 return None 339 fake_build = fake_builder[index] 340 build = Build( 341 builder=fake_builder, 342 build_number=index, 343 revision=fake_build[0], 344 is_green=fake_build[1], 345 ) 346 def mock_previous_build(): 347 return self._build_from_fake(fake_builder, index + 1) 348 build.previous_build = mock_previous_build 349 return build 350 351 def _fake_builds_at_index(self, index): 352 return [self._build_from_fake(builder, index) for builder in self.fake_builders] 353 354 def test_last_green_revision(self): 355 buildbot = BuildBot() 356 def mock_builds_from_builders(only_core_builders): 357 return self._fake_builds_at_index(0) 358 buildbot._latest_builds_from_builders = mock_builds_from_builders 359 self.assertEqual(buildbot.last_green_revision(), 1) 360 322 361 323 362 if __name__ == '__main__': -
trunk/WebKitTools/Scripts/webkitpy/tool/commands/queries.py
r56586 r56602 107 107 108 108 109 class LastGreenRevision(AbstractDeclarativeCommand): 110 name = "last-green-revision" 111 help_text = "Prints the last known good revision" 112 113 def execute(self, options, args, tool): 114 print self.tool.buildbot.last_green_revision() 115 116 109 117 class WhatBroke(AbstractDeclarativeCommand): 110 118 name = "what-broke"
Note: See TracChangeset
for help on using the changeset viewer.