| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 baseline_search_path = port.baseline_search_path() | 109 baseline_search_path = port.baseline_search_path() |
| 110 try: | 110 try: |
| 111 index = baseline_search_path.index(path_to_rebaseline) | 111 index = baseline_search_path.index(path_to_rebaseline) |
| 112 if index: | 112 if index: |
| 113 immediate_predecessors_in_fallback.append(self._tool.filesys
tem.basename(baseline_search_path[index - 1])) | 113 immediate_predecessors_in_fallback.append(self._tool.filesys
tem.basename(baseline_search_path[index - 1])) |
| 114 except ValueError: | 114 except ValueError: |
| 115 # index throw's a ValueError if the item isn't in the list. | 115 # index throw's a ValueError if the item isn't in the list. |
| 116 pass | 116 pass |
| 117 return immediate_predecessors_in_fallback | 117 return immediate_predecessors_in_fallback |
| 118 | 118 |
| 119 def _port_for_primary_baseline(self, baseline): |
| 120 for port in [self._tool.port_factory.get(port_name) for port_name in sel
f._tool.port_factory.all_port_names()]: |
| 121 if self._tool.filesystem.basename(port.baseline_version_dir()) == ba
seline: |
| 122 return port |
| 123 raise Exception("Failed to find port for primary baseline %s." % baselin
e) |
| 124 |
| 119 def _copy_existing_baseline(self, move_overwritten_baselines_to, test_name,
suffix): | 125 def _copy_existing_baseline(self, move_overwritten_baselines_to, test_name,
suffix): |
| 120 old_baselines = [] | 126 old_baselines = [] |
| 121 new_baselines = [] | 127 new_baselines = [] |
| 122 | 128 |
| 123 # Need to gather all the baseline paths before modifying the filesystem
since | 129 # Need to gather all the baseline paths before modifying the filesystem
since |
| 124 # the modifications can affect the results of port.expected_filename. | 130 # the modifications can affect the results of port.expected_filename. |
| 125 for platform in move_overwritten_baselines_to: | 131 for port in [self._port_for_primary_baseline(baseline) for baseline in m
ove_overwritten_baselines_to]: |
| 126 port = self._tool.port_factory.get(platform) | |
| 127 old_baseline = port.expected_filename(test_name, "." + suffix) | 132 old_baseline = port.expected_filename(test_name, "." + suffix) |
| 128 if not self._tool.filesystem.exists(old_baseline): | 133 if not self._tool.filesystem.exists(old_baseline): |
| 129 _log.debug("No existing baseline for %s." % test_name) | 134 _log.debug("No existing baseline for %s." % test_name) |
| 130 continue | 135 continue |
| 131 | 136 |
| 132 new_baseline = self._tool.filesystem.join(port.baseline_path(), self
._file_name_for_expected_result(test_name, suffix)) | 137 new_baseline = self._tool.filesystem.join(port.baseline_path(), self
._file_name_for_expected_result(test_name, suffix)) |
| 133 if self._tool.filesystem.exists(new_baseline): | 138 if self._tool.filesystem.exists(new_baseline): |
| 134 _log.debug("Existing baseline at %s, not copying over it." % new
_baseline) | 139 _log.debug("Existing baseline at %s, not copying over it." % new
_baseline) |
| 135 continue | 140 continue |
| 136 | 141 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 tests = args or self._tests_to_update(builder) | 509 tests = args or self._tests_to_update(builder) |
| 505 for test in tests: | 510 for test in tests: |
| 506 if test not in test_prefix_list: | 511 if test not in test_prefix_list: |
| 507 test_prefix_list[test] = {} | 512 test_prefix_list[test] = {} |
| 508 test_prefix_list[test][builder.name()] = suffixes_to_update | 513 test_prefix_list[test][builder.name()] = suffixes_to_update |
| 509 | 514 |
| 510 if options.verbose: | 515 if options.verbose: |
| 511 _log.debug("rebaseline-json: " + str(test_prefix_list)) | 516 _log.debug("rebaseline-json: " + str(test_prefix_list)) |
| 512 | 517 |
| 513 self._rebaseline(options, test_prefix_list) | 518 self._rebaseline(options, test_prefix_list) |
| OLD | NEW |