Changeset 121800 in webkit
- Timestamp:
- Jul 3, 2012 1:23:41 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r121799 r121800 1 2012-07-03 Ojan Vafai <ojan@chromium.org> 2 3 Have webkit-patch rebaseline use rebaseline-test-internal 4 https://bugs.webkit.org/show_bug.cgi?id=90491 5 6 Reviewed by Dirk Pranke. 7 8 This lets it handle new files, reduces duplicate code and lays the 9 groundwork for making rebaseline have a richer interface. 10 11 * Scripts/webkitpy/common/net/buildbot/buildbot_mock.py: 12 (MockBuild): 13 (MockBuild.__init__): 14 (MockBuilder.build): 15 * Scripts/webkitpy/tool/commands/rebaseline.py: 16 (AbstractParallelRebaselineCommand._files_to_add): 17 (Rebaseline): 18 (Rebaseline._builder_to_pull_from): 19 (Rebaseline._tests_to_update): 20 (Rebaseline.execute): 21 * Scripts/webkitpy/tool/commands/rebaseline_unittest.py: 22 (test_overrides_are_included_correctly): 23 (test_rebaseline): 24 (test_rebaseline.mock_builder_to_pull_from): 25 (test_rebaseline.mock_tests_to_update): 26 1 27 2012-07-03 Ojan Vafai <ojan@chromium.org> 2 28 -
trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_mock.py
r110997 r121800 28 28 29 29 30 class MockBuild(object): 31 def __init__(self, build_number, revision, is_green): 32 self._number = build_number 33 self._revision = revision 34 self._is_green = is_green 35 30 36 class MockBuilder(object): 31 37 def __init__(self, name): … … 34 40 def name(self): 35 41 return self._name 42 43 def build(self, build_number): 44 return MockBuild(build_number=build_number, revision=1234, is_green=False) 36 45 37 46 def results_url(self): -
trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
r121799 r121800 279 279 def _files_to_add(self, command_results): 280 280 files_to_add = set() 281 for output in [result[1] for result in command_results]: 282 try: 283 files_to_add.update(json.loads(output)['add']) 284 except ValueError, e: 285 _log.warning('"%s" is not a JSON object, ignoring' % output) 281 for output in [result[1].split('\n') for result in command_results]: 282 file_added = False 283 for line in output: 284 try: 285 files_to_add.update(json.loads(line)['add']) 286 file_added = True 287 except ValueError, e: 288 _log.debug('"%s" is not a JSON object, ignoring' % line) 289 290 if not file_added: 291 _log.debug('Could not add file based off output "%s"' % output) 292 286 293 287 294 return list(files_to_add) … … 361 368 362 369 363 # FIXME: Make this use AbstractParallelRebaselineCommand. 364 class Rebaseline(AbstractDeclarativeCommand): 370 class Rebaseline(AbstractParallelRebaselineCommand): 365 371 name = "rebaseline" 366 372 help_text = "Replaces local expected.txt files with new results from build bots" … … 378 384 return (self._tool.buildbot.builder_with_name(chosen_name), status["build_number"]) 379 385 380 def _replace_expectation_with_remote_result(self, local_file, remote_file):381 (downloaded_file, headers) = urllib.urlretrieve(remote_file)382 shutil.move(downloaded_file, local_file)383 384 386 def _tests_to_update(self, build): 385 387 failing_tests = build.layout_test_results().tests_matching_failure_types([test_failures.FailureTextMismatch]) 386 388 return self._tool.user.prompt_with_list("Which test(s) to rebaseline:", failing_tests, can_choose_multiple=True) 387 389 388 def _results_url_for_test(self, build, test):389 test_base = os.path.splitext(test)[0]390 actual_path = test_base + "-actual.txt"391 return build.results_url() + "/" + actual_path392 393 390 def execute(self, options, args, tool): 394 391 builder, build_number = self._builder_to_pull_from() 395 392 build = builder.build(build_number) 396 port = tool.port_factory.get_from_builder_name(builder.name()) 397 393 394 builder_name = builder.name() 395 test_list = {} 398 396 for test in self._tests_to_update(build): 399 results_url = self._results_url_for_test(build, test) 400 # Port operates with absolute paths. 401 expected_file = port.expected_filename(test, '.txt') 402 _log.info(test) 403 self._replace_expectation_with_remote_result(expected_file, results_url) 404 405 # FIXME: We should handle new results too. 397 test_list[test] = {builder_name: ['txt']} 398 self._rebaseline(options, test_list) -
trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
r121799 r121800 33 33 from webkitpy.tool.commands.rebaseline import * 34 34 from webkitpy.tool.mocktool import MockTool, MockOptions 35 from webkitpy.common.net.buildbot.buildbot_mock import MockBuilder 35 36 from webkitpy.common.system.executive_mock import MockExecutive 36 37 … … 332 333 self.assertEquals(command._tests_to_rebaseline(port), {'userscripts/another-test.html': set(['txt'])}) 333 334 self.assertEquals(port._filesystem.read_text_file(expectations_path), expectations_contents) 335 336 def test_rebaseline(self): 337 old_exact_matches = builders._exact_matches 338 try: 339 builders._exact_matches = { 340 "MOCK builder": {"port_name": "test-mac-leopard", "specifiers": set(["mock-specifier"])}, 341 } 342 343 command = Rebaseline() 344 tool = MockTool() 345 command.bind_to_tool(tool) 346 347 for port_name in tool.port_factory.all_port_names(): 348 port = tool.port_factory.get(port_name) 349 for path in port.expectations_files(): 350 tool.filesystem.write_text_file(path, '') 351 352 tool.executive = MockExecutive(should_log=True) 353 354 def mock_builder_to_pull_from(): 355 return MockBuilder('MOCK builder'), 1234 356 357 def mock_tests_to_update(build): 358 return ['mock/path/to/test.html'] 359 360 command._builder_to_pull_from = mock_builder_to_pull_from 361 command._tests_to_update = mock_tests_to_update 362 363 expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '--builder', 'MOCK builder', '--test', 'mock/path/to/test.html'], cwd=/mock-checkout 364 MOCK run_command: ['echo', 'optimize-baselines', '--suffixes', 'txt', 'mock/path/to/test.html'], cwd=/mock-checkout 365 """ 366 367 OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=True), [], tool], expected_stderr=expected_stderr) 368 369 finally: 370 builders._exact_matches = old_exact_matches
Note: See TracChangeset
for help on using the changeset viewer.