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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 def __init__(self): | 141 def __init__(self): |
142 super(CopyExistingBaselinesInternal, self).__init__(options=[ | 142 super(CopyExistingBaselinesInternal, self).__init__(options=[ |
143 self.results_directory_option, | 143 self.results_directory_option, |
144 self.suffixes_option, | 144 self.suffixes_option, |
145 self.builder_option, | 145 self.builder_option, |
146 self.test_option, | 146 self.test_option, |
147 ]) | 147 ]) |
148 | 148 |
149 @memoized | 149 @memoized |
150 def _immediate_predecessors_in_fallback(self, path_to_rebaseline): | 150 def _immediate_predecessors_in_fallback(self, path_to_rebaseline): |
| 151 """Returns the predecessor directories in the baseline fall-back graph. |
| 152 |
| 153 The platform-specific fall-back baseline directories form a tree; the |
| 154 "immediate predecessors" are the children nodes For example, if the |
| 155 baseline fall-back graph includes: |
| 156 "mac10.9" -> "mac10.10/" |
| 157 "mac10.10/" -> "mac/" |
| 158 "retina/" -> "mac/" |
| 159 Then, the "immediate predecessors" are: |
| 160 "mac/": ["mac10.10/", "retina/"] |
| 161 "mac10.10/": ["mac10.9/"] |
| 162 "mac10.9/", "retina/": [] |
| 163 """ |
151 port_names = self._tool.port_factory.all_port_names() | 164 port_names = self._tool.port_factory.all_port_names() |
152 immediate_predecessors = [] | 165 immediate_predecessors = [] |
153 for port_name in port_names: | 166 for port_name in port_names: |
154 port = self._tool.port_factory.get(port_name) | 167 port = self._tool.port_factory.get(port_name) |
155 if not port.buildbot_archives_baselines(): | 168 if not port.buildbot_archives_baselines(): |
156 continue | 169 continue |
157 baseline_search_path = port.baseline_search_path() | 170 baseline_search_path = port.baseline_search_path() |
158 try: | 171 try: |
159 index = baseline_search_path.index(path_to_rebaseline) | 172 index = baseline_search_path.index(path_to_rebaseline) |
160 if index: | 173 if index: |
161 immediate_predecessors.append(self._tool.filesystem.basename
(baseline_search_path[index - 1])) | 174 immediate_predecessors.append(self._tool.filesystem.basename
(baseline_search_path[index - 1])) |
162 except ValueError: | 175 except ValueError: |
163 # baseline_search_path.index() throws a ValueError if the item i
sn't in the list. | 176 # baseline_search_path.index() throws a ValueError if the item i
sn't in the list. |
164 pass | 177 pass |
165 return immediate_predecessors | 178 return immediate_predecessors |
166 | 179 |
167 def _port_for_primary_baseline(self, baseline): | 180 def _port_for_primary_baseline(self, baseline): |
| 181 """Returns a Port object for the given baseline directory base name.""" |
168 for port in [self._tool.port_factory.get(port_name) for port_name in sel
f._tool.port_factory.all_port_names()]: | 182 for port in [self._tool.port_factory.get(port_name) for port_name in sel
f._tool.port_factory.all_port_names()]: |
169 if self._tool.filesystem.basename(port.baseline_version_dir()) == ba
seline: | 183 if self._tool.filesystem.basename(port.baseline_version_dir()) == ba
seline: |
170 return port | 184 return port |
171 raise Exception("Failed to find port for primary baseline %s." % baselin
e) | 185 raise Exception("Failed to find port for primary baseline %s." % baselin
e) |
172 | 186 |
173 def _copy_existing_baseline(self, builder_name, test_name, suffix): | 187 def _copy_existing_baseline(self, builder_name, test_name, suffix): |
| 188 """Copies the baseline for the given builder to all "predecessor" direct
ories.""" |
174 baseline_directory = self._baseline_directory(builder_name) | 189 baseline_directory = self._baseline_directory(builder_name) |
175 ports = [self._port_for_primary_baseline(baseline) | 190 ports = [self._port_for_primary_baseline(baseline) |
176 for baseline in self._immediate_predecessors_in_fallback(baseli
ne_directory)] | 191 for baseline in self._immediate_predecessors_in_fallback(baseli
ne_directory)] |
177 | 192 |
178 old_baselines = [] | 193 old_baselines = [] |
179 new_baselines = [] | 194 new_baselines = [] |
180 | 195 |
181 # Need to gather all the baseline paths before modifying the filesystem
since | 196 # Need to gather all the baseline paths before modifying the filesystem
since |
182 # the modifications can affect the results of port.expected_filename. | 197 # the modifications can affect the results of port.expected_filename. |
183 for port in ports: | 198 for port in ports: |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 for test in args: | 732 for test in args: |
718 if test not in test_prefix_list: | 733 if test not in test_prefix_list: |
719 test_prefix_list[test] = {} | 734 test_prefix_list[test] = {} |
720 build = Build(builder) | 735 build = Build(builder) |
721 test_prefix_list[test][build] = suffixes_to_update | 736 test_prefix_list[test][build] = suffixes_to_update |
722 | 737 |
723 if options.verbose: | 738 if options.verbose: |
724 _log.debug("rebaseline-json: " + str(test_prefix_list)) | 739 _log.debug("rebaseline-json: " + str(test_prefix_list)) |
725 | 740 |
726 self.rebaseline(options, test_prefix_list) | 741 self.rebaseline(options, test_prefix_list) |
OLD | NEW |