| OLD | NEW |
| 1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * 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 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 release_builders.add(builder) | 339 release_builders.add(builder) |
| 340 else: | 340 else: |
| 341 debug_builders.add(builder) | 341 debug_builders.add(builder) |
| 342 for builder in list(release_builders) + list(debug_builders): | 342 for builder in list(release_builders) + list(debug_builders): |
| 343 port = self._tool.port_factory.get_from_builder_name(builder) | 343 port = self._tool.port_factory.get_from_builder_name(builder) |
| 344 fallback_path = port.baseline_search_path() | 344 fallback_path = port.baseline_search_path() |
| 345 if fallback_path not in builders_to_fallback_paths.values(): | 345 if fallback_path not in builders_to_fallback_paths.values(): |
| 346 builders_to_fallback_paths[builder] = fallback_path | 346 builders_to_fallback_paths[builder] = fallback_path |
| 347 return builders_to_fallback_paths.keys() | 347 return builders_to_fallback_paths.keys() |
| 348 | 348 |
| 349 def _rebaseline_commands(self, test_prefix_list, options): | 349 def _rebaseline_commands(self, test_prefix_list, options, skip_checking_actu
al_results=False): |
| 350 path_to_webkit_patch = self._tool.path() | 350 path_to_webkit_patch = self._tool.path() |
| 351 cwd = self._tool.scm().checkout_root | 351 cwd = self._tool.scm().checkout_root |
| 352 copy_baseline_commands = [] | 352 copy_baseline_commands = [] |
| 353 rebaseline_commands = [] | 353 rebaseline_commands = [] |
| 354 lines_to_remove = {} | 354 lines_to_remove = {} |
| 355 port = self._tool.port_factory.get() | 355 port = self._tool.port_factory.get() |
| 356 | 356 |
| 357 for test_prefix in test_prefix_list: | 357 for test_prefix in test_prefix_list: |
| 358 for test in port.tests([test_prefix]): | 358 for test in port.tests([test_prefix]): |
| 359 for builder in self._builders_to_fetch_from(test_prefix_list[tes
t_prefix]): | 359 for builder in self._builders_to_fetch_from(test_prefix_list[tes
t_prefix]): |
| 360 actual_failures_suffixes = self._suffixes_for_actual_failure
s( | 360 # TODO(qyearsley): Remove the parameter skip_checking_actual
_results |
| 361 test, builder, test_prefix_list[test_prefix][builder]) | 361 # and instead refactor the existing code so that this is not
necessary. |
| 362 if skip_checking_actual_results: |
| 363 actual_failures_suffixes = test_prefix_list[test_prefix]
[builder] |
| 364 else: |
| 365 actual_failures_suffixes = self._suffixes_for_actual_fai
lures( |
| 366 test, builder, test_prefix_list[test_prefix][builder
]) |
| 362 if not actual_failures_suffixes: | 367 if not actual_failures_suffixes: |
| 363 # If we're not going to rebaseline the test because it's
passing on this | 368 # If we're not going to rebaseline the test because it's
passing on this |
| 364 # builder, we still want to remove the line from TestExp
ectations. | 369 # builder, we still want to remove the line from TestExp
ectations. |
| 365 if test not in lines_to_remove: | 370 if test not in lines_to_remove: |
| 366 lines_to_remove[test] = [] | 371 lines_to_remove[test] = [] |
| 367 lines_to_remove[test].append(builder) | 372 lines_to_remove[test].append(builder) |
| 368 continue | 373 continue |
| 369 | 374 |
| 370 suffixes = ','.join(actual_failures_suffixes) | 375 suffixes = ','.join(actual_failures_suffixes) |
| 371 cmd_line = ['--suffixes', suffixes, '--builder', builder, '-
-test', test] | 376 cmd_line = ['--suffixes', suffixes, '--builder', builder, '-
-test', test] |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 if line: | 489 if line: |
| 485 _log.error(line) | 490 _log.error(line) |
| 486 | 491 |
| 487 files_to_add, files_to_delete, lines_to_remove = self._serial_commands(c
ommand_results) | 492 files_to_add, files_to_delete, lines_to_remove = self._serial_commands(c
ommand_results) |
| 488 if files_to_delete: | 493 if files_to_delete: |
| 489 self._tool.scm().delete_list(files_to_delete) | 494 self._tool.scm().delete_list(files_to_delete) |
| 490 if files_to_add: | 495 if files_to_add: |
| 491 self._tool.scm().add_list(files_to_add) | 496 self._tool.scm().add_list(files_to_add) |
| 492 return lines_to_remove | 497 return lines_to_remove |
| 493 | 498 |
| 494 def _rebaseline(self, options, test_prefix_list): | 499 def _rebaseline(self, options, test_prefix_list, skip_checking_actual_result
s=False): |
| 495 """Downloads new baselines in parallel, then updates expectations files | 500 """Downloads new baselines in parallel, then updates expectations files |
| 496 and optimizes baselines. | 501 and optimizes baselines. |
| 497 | 502 |
| 498 Args: | 503 Args: |
| 499 options: An object with the options passed to the current command. | 504 options: An object with the options passed to the current command. |
| 500 test_prefix_list: A map of test names to builder names to baseline | 505 test_prefix_list: A map of test names to builder names to baseline |
| 501 suffixes to rebaseline. For example: | 506 suffixes to rebaseline. For example: |
| 502 { | 507 { |
| 503 "some/test.html": {"builder-1": ["txt"], "builder-2": ["txt"
]}, | 508 "some/test.html": {"builder-1": ["txt"], "builder-2": ["txt"
]}, |
| 504 "some/other.html": {"builder-1": ["txt"]} | 509 "some/other.html": {"builder-1": ["txt"]} |
| 505 } | 510 } |
| 506 This would mean that new text baselines should be downloaded for | 511 This would mean that new text baselines should be downloaded for |
| 507 "some/test.html" on both builder-1 and builder-2, and new text | 512 "some/test.html" on both builder-1 and builder-2, and new text |
| 508 baselines should be downloaded for "some/other.html" but only | 513 baselines should be downloaded for "some/other.html" but only |
| 509 from builder-1. | 514 from builder-1. |
| 515 skip_checking_actual_results: If True, then the lists of suffixes |
| 516 to rebaseline from |test_prefix_list| will be used directly; |
| 517 if False, then the list of suffixes will filtered to include |
| 518 suffixes with mismatches in actual results. |
| 510 """ | 519 """ |
| 511 for test, builders_to_check in sorted(test_prefix_list.items()): | 520 for test, builders_to_check in sorted(test_prefix_list.items()): |
| 512 _log.info("Rebaselining %s" % test) | 521 _log.info("Rebaselining %s" % test) |
| 513 for builder, suffixes in sorted(builders_to_check.items()): | 522 for builder, suffixes in sorted(builders_to_check.items()): |
| 514 _log.debug(" %s: %s" % (builder, ",".join(suffixes))) | 523 _log.debug(" %s: %s" % (builder, ",".join(suffixes))) |
| 515 | 524 |
| 516 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel
f._rebaseline_commands(test_prefix_list, options) | 525 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel
f._rebaseline_commands( |
| 526 test_prefix_list, options, skip_checking_actual_results) |
| 517 lines_to_remove = {} | 527 lines_to_remove = {} |
| 518 | 528 |
| 519 self._run_in_parallel_and_update_scm(copy_baseline_commands) | 529 self._run_in_parallel_and_update_scm(copy_baseline_commands) |
| 520 lines_to_remove = self._run_in_parallel_and_update_scm(rebaseline_comman
ds) | 530 lines_to_remove = self._run_in_parallel_and_update_scm(rebaseline_comman
ds) |
| 521 | 531 |
| 522 for test in extra_lines_to_remove: | 532 for test in extra_lines_to_remove: |
| 523 if test in lines_to_remove: | 533 if test in lines_to_remove: |
| 524 lines_to_remove[test] = lines_to_remove[test] + extra_lines_to_r
emove[test] | 534 lines_to_remove[test] = lines_to_remove[test] + extra_lines_to_r
emove[test] |
| 525 else: | 535 else: |
| 526 lines_to_remove[test] = extra_lines_to_remove[test] | 536 lines_to_remove[test] = extra_lines_to_remove[test] |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 issue_already_closed = tool.executive.run_command( | 925 issue_already_closed = tool.executive.run_command( |
| 916 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], | 926 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], |
| 917 return_exit_code=True) | 927 return_exit_code=True) |
| 918 if not issue_already_closed: | 928 if not issue_already_closed: |
| 919 self._run_git_cl_command(options, ['set_close']) | 929 self._run_git_cl_command(options, ['set_close']) |
| 920 | 930 |
| 921 tool.scm().ensure_cleanly_tracking_remote_master() | 931 tool.scm().ensure_cleanly_tracking_remote_master() |
| 922 if old_branch_name_or_ref: | 932 if old_branch_name_or_ref: |
| 923 tool.scm().checkout_branch(old_branch_name_or_ref) | 933 tool.scm().checkout_branch(old_branch_name_or_ref) |
| 924 tool.scm().delete_branch(rebaseline_branch_name) | 934 tool.scm().delete_branch(rebaseline_branch_name) |
| OLD | NEW |