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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
487 _log.error(line) | 487 _log.error(line) |
488 | 488 |
489 files_to_add, files_to_delete, lines_to_remove = self._serial_commands(c ommand_results) | 489 files_to_add, files_to_delete, lines_to_remove = self._serial_commands(c ommand_results) |
490 if files_to_delete: | 490 if files_to_delete: |
491 self._tool.scm().delete_list(files_to_delete) | 491 self._tool.scm().delete_list(files_to_delete) |
492 if files_to_add: | 492 if files_to_add: |
493 self._tool.scm().add_list(files_to_add) | 493 self._tool.scm().add_list(files_to_add) |
494 return lines_to_remove | 494 return lines_to_remove |
495 | 495 |
496 def _rebaseline(self, options, test_prefix_list): | 496 def _rebaseline(self, options, test_prefix_list): |
497 """Downloads new baselines in parallel, then updates expectations files | |
498 and optimizes baselines. | |
499 | |
500 Args: | |
501 options: An object with the options passed to the current command. | |
502 test_prefix_list: A map of test names to builder names to baseline | |
503 suffixes to rebaseline. For example: | |
504 { | |
505 "some/test.html": {"builder-1": ["txt"], "builder-2": ["txt" ]}, | |
506 "some/other.html": {"builder-1": ["txt"]} | |
507 } | |
508 This would mean that new text baselines should be downloaded for | |
509 "some/test.html" on both builder-1 and builder-2, and new text | |
510 baselines should be downloaded for "some/other.html" but only | |
511 from builder-1. | |
512 """ | |
497 for test, builders_to_check in sorted(test_prefix_list.items()): | 513 for test, builders_to_check in sorted(test_prefix_list.items()): |
498 _log.info("Rebaselining %s" % test) | 514 _log.info("Rebaselining %s" % test) |
499 for builder, suffixes in sorted(builders_to_check.items()): | 515 for builder, suffixes in sorted(builders_to_check.items()): |
500 _log.debug(" %s: %s" % (builder, ",".join(suffixes))) | 516 _log.debug(" %s: %s" % (builder, ",".join(suffixes))) |
501 | 517 |
502 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel f._rebaseline_commands(test_prefix_list, options) | 518 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel f._rebaseline_commands(test_prefix_list, options) |
503 lines_to_remove = {} | 519 lines_to_remove = {} |
504 | 520 |
505 self._run_in_parallel_and_update_scm(copy_baseline_commands) | 521 self._run_in_parallel_and_update_scm(copy_baseline_commands) |
506 lines_to_remove = self._run_in_parallel_and_update_scm(rebaseline_comman ds) | 522 lines_to_remove = self._run_in_parallel_and_update_scm(rebaseline_comman ds) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 def _tests_to_rebaseline(self, port): | 573 def _tests_to_rebaseline(self, port): |
558 tests_to_rebaseline = {} | 574 tests_to_rebaseline = {} |
559 for path, value in port.expectations_dict().items(): | 575 for path, value in port.expectations_dict().items(): |
560 expectations = TestExpectations(port, include_overrides=False, expec tations_dict={path: value}) | 576 expectations = TestExpectations(port, include_overrides=False, expec tations_dict={path: value}) |
561 for test in expectations.get_rebaselining_failures(): | 577 for test in expectations.get_rebaselining_failures(): |
562 suffixes = TestExpectations.suffixes_for_expectations(expectatio ns.get_expectations(test)) | 578 suffixes = TestExpectations.suffixes_for_expectations(expectatio ns.get_expectations(test)) |
563 tests_to_rebaseline[test] = suffixes or BASELINE_SUFFIX_LIST | 579 tests_to_rebaseline[test] = suffixes or BASELINE_SUFFIX_LIST |
564 return tests_to_rebaseline | 580 return tests_to_rebaseline |
565 | 581 |
566 def _add_tests_to_rebaseline_for_port(self, port_name): | 582 def _add_tests_to_rebaseline_for_port(self, port_name): |
583 """Adds tests to self._test_prefix_list for the given port.""" | |
wkorman
2016/06/30 19:17:12
Which tests does it add?
qyearsley
2016/06/30 21:20:39
I believe it's tests that appear in the TestExpect
| |
567 builder_name = self._tool.builders.builder_name_for_port_name(port_name) | 584 builder_name = self._tool.builders.builder_name_for_port_name(port_name) |
568 if not builder_name: | 585 if not builder_name: |
569 return | 586 return |
570 tests = self._tests_to_rebaseline(self._tool.port_factory.get(port_name) ).items() | 587 tests = self._tests_to_rebaseline(self._tool.port_factory.get(port_name) ).items() |
571 | 588 |
572 if tests: | 589 if tests: |
573 _log.info("Retrieving results for %s from %s." % (port_name, builder _name)) | 590 _log.info("Retrieving results for %s from %s." % (port_name, builder _name)) |
574 | 591 |
575 for test_name, suffixes in tests: | 592 for test_name, suffixes in tests: |
576 _log.info(" %s (%s)" % (test_name, ','.join(suffixes))) | 593 _log.info(" %s (%s)" % (test_name, ','.join(suffixes))) |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
901 issue_already_closed = tool.executive.run_command( | 918 issue_already_closed = tool.executive.run_command( |
902 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline _branch_name], | 919 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline _branch_name], |
903 return_exit_code=True) | 920 return_exit_code=True) |
904 if not issue_already_closed: | 921 if not issue_already_closed: |
905 self._run_git_cl_command(options, ['set_close']) | 922 self._run_git_cl_command(options, ['set_close']) |
906 | 923 |
907 tool.scm().ensure_cleanly_tracking_remote_master() | 924 tool.scm().ensure_cleanly_tracking_remote_master() |
908 if old_branch_name_or_ref: | 925 if old_branch_name_or_ref: |
909 tool.scm().checkout_branch(old_branch_name_or_ref) | 926 tool.scm().checkout_branch(old_branch_name_or_ref) |
910 tool.scm().delete_branch(rebaseline_branch_name) | 927 tool.scm().delete_branch(rebaseline_branch_name) |
OLD | NEW |