Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 2776543003: Change rebaseline-test-internal to take port name option. (Closed)
Patch Set: Change argument order, finish docstring Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 '(default is to de-dupe automatically). You can use "webkit-patch ' 57 '(default is to de-dupe automatically). You can use "webkit-patch '
58 'optimize-baselines" to optimize separately.')) 58 'optimize-baselines" to optimize separately.'))
59 platform_options = factory.platform_options(use_globs=True) 59 platform_options = factory.platform_options(use_globs=True)
60 results_directory_option = optparse.make_option( 60 results_directory_option = optparse.make_option(
61 '--results-directory', help='Local results directory to use.') 61 '--results-directory', help='Local results directory to use.')
62 suffixes_option = optparse.make_option( 62 suffixes_option = optparse.make_option(
63 '--suffixes', default=','.join(BASELINE_SUFFIX_LIST), action='store', 63 '--suffixes', default=','.join(BASELINE_SUFFIX_LIST), action='store',
64 help='Comma-separated-list of file types to rebaseline.') 64 help='Comma-separated-list of file types to rebaseline.')
65 builder_option = optparse.make_option( 65 builder_option = optparse.make_option(
66 '--builder', help='Builder to pull new baselines from.') 66 '--builder', help='Builder to pull new baselines from.')
67 port_name_option = optparse.make_option(
68 '--port-name',
69 help=('Fully-qualified name of the port that new baselines belong to. '
70 'If not given, this is determined based on --builder.'))
wkorman 2017/03/24 18:56:05 Maybe include an example value for people unfamili
qyearsley 2017/03/24 21:10:59 Sounds good. In this case, --port-name is only use
67 test_option = optparse.make_option('--test', help='Test to rebaseline.') 71 test_option = optparse.make_option('--test', help='Test to rebaseline.')
68 build_number_option = optparse.make_option( 72 build_number_option = optparse.make_option(
69 '--build-number', default=None, type='int', 73 '--build-number', default=None, type='int',
70 help='Optional build number; if not given, the latest build is used.') 74 help='Optional build number; if not given, the latest build is used.')
71 75
72 def __init__(self, options=None): 76 def __init__(self, options=None):
73 super(AbstractRebaseliningCommand, self).__init__(options=options) 77 super(AbstractRebaseliningCommand, self).__init__(options=options)
74 self._baseline_suffix_list = BASELINE_SUFFIX_LIST 78 self._baseline_suffix_list = BASELINE_SUFFIX_LIST
75 self.expectation_line_changes = ChangeSet() 79 self.expectation_line_changes = ChangeSet()
76 self._tool = None 80 self._tool = None
(...skipping 18 matching lines...) Expand all
95 class ChangeSet(object): 99 class ChangeSet(object):
96 """A record of TestExpectation lines to remove. 100 """A record of TestExpectation lines to remove.
97 101
98 TODO(qyearsley): Remove this class, track list of lines to remove directly 102 TODO(qyearsley): Remove this class, track list of lines to remove directly
99 in an attribute of AbstractRebaseliningCommand. 103 in an attribute of AbstractRebaseliningCommand.
100 """ 104 """
101 105
102 def __init__(self, lines_to_remove=None): 106 def __init__(self, lines_to_remove=None):
103 self.lines_to_remove = lines_to_remove or {} 107 self.lines_to_remove = lines_to_remove or {}
104 108
105 def remove_line(self, test, builder): 109 def remove_line(self, test, port_name):
106 if test not in self.lines_to_remove: 110 if test not in self.lines_to_remove:
107 self.lines_to_remove[test] = [] 111 self.lines_to_remove[test] = []
108 self.lines_to_remove[test].append(builder) 112 self.lines_to_remove[test].append(port_name)
109 113
110 def to_dict(self): 114 def to_dict(self):
111 remove_lines = [] 115 remove_lines = []
112 for test in self.lines_to_remove: 116 for test in self.lines_to_remove:
113 for builder in self.lines_to_remove[test]: 117 for port_name in self.lines_to_remove[test]:
114 remove_lines.append({'test': test, 'builder': builder}) 118 remove_lines.append({'test': test, 'port_name': port_name})
115 return {'remove-lines': remove_lines} 119 return {'remove-lines': remove_lines}
116 120
117 @staticmethod 121 @staticmethod
118 def from_dict(change_dict): 122 def from_dict(change_dict):
119 lines_to_remove = {} 123 lines_to_remove = {}
120 if 'remove-lines' in change_dict: 124 if 'remove-lines' in change_dict:
121 for line_to_remove in change_dict['remove-lines']: 125 for line_to_remove in change_dict['remove-lines']:
122 test = line_to_remove['test'] 126 test = line_to_remove['test']
123 builder = line_to_remove['builder'] 127 port_name = line_to_remove['port_name']
124 if test not in lines_to_remove: 128 if test not in lines_to_remove:
125 lines_to_remove[test] = [] 129 lines_to_remove[test] = []
126 lines_to_remove[test].append(builder) 130 lines_to_remove[test].append(port_name)
127 return ChangeSet(lines_to_remove=lines_to_remove) 131 return ChangeSet(lines_to_remove=lines_to_remove)
128 132
129 def update(self, other): 133 def update(self, other):
130 assert isinstance(other, ChangeSet) 134 assert isinstance(other, ChangeSet)
131 assert isinstance(other.lines_to_remove, dict) 135 assert isinstance(other.lines_to_remove, dict)
132 for test in other.lines_to_remove: 136 for test in other.lines_to_remove:
133 if test not in self.lines_to_remove: 137 if test not in self.lines_to_remove:
134 self.lines_to_remove[test] = [] 138 self.lines_to_remove[test] = []
135 self.lines_to_remove[test].extend(other.lines_to_remove[test]) 139 self.lines_to_remove[test].extend(other.lines_to_remove[test])
136 140
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return self._builder_names 185 return self._builder_names
182 186
183 187
184 class CopyExistingBaselinesInternal(AbstractRebaseliningCommand): 188 class CopyExistingBaselinesInternal(AbstractRebaseliningCommand):
185 name = 'copy-existing-baselines-internal' 189 name = 'copy-existing-baselines-internal'
186 help_text = ('Copy existing baselines down one level in the baseline order t o ensure ' 190 help_text = ('Copy existing baselines down one level in the baseline order t o ensure '
187 "new baselines don't break existing passing platforms.") 191 "new baselines don't break existing passing platforms.")
188 192
189 def __init__(self): 193 def __init__(self):
190 super(CopyExistingBaselinesInternal, self).__init__(options=[ 194 super(CopyExistingBaselinesInternal, self).__init__(options=[
195 self.test_option,
196 self.suffixes_option,
197 self.port_name_option,
191 self.results_directory_option, 198 self.results_directory_option,
192 self.suffixes_option,
193 self.builder_option,
194 self.test_option,
195 ]) 199 ])
196 200
197 @memoized 201 @memoized
198 def _immediate_predecessors_in_fallback(self, path_to_rebaseline): 202 def _immediate_predecessors_in_fallback(self, path_to_rebaseline):
199 """Returns the predecessor directories in the baseline fall-back graph. 203 """Returns the predecessor directories in the baseline fall-back graph.
200 204
201 The platform-specific fall-back baseline directories form a tree; the 205 The platform-specific fall-back baseline directories form a tree, where
202 "immediate predecessors" are the children nodes For example, if the 206 when we search for baselines we normally fall back to parents nodes in
203 baseline fall-back graph includes: 207 the tree. The "immediate predecessors" are the children nodes of the
208 given node.
209
210 For example, if the baseline fall-back graph includes:
204 "mac10.9" -> "mac10.10/" 211 "mac10.9" -> "mac10.10/"
205 "mac10.10/" -> "mac/" 212 "mac10.10/" -> "mac/"
206 "retina/" -> "mac/" 213 "retina/" -> "mac/"
207 Then, the "immediate predecessors" are: 214 Then, the "immediate predecessors" are:
208 "mac/": ["mac10.10/", "retina/"] 215 "mac/": ["mac10.10/", "retina/"]
209 "mac10.10/": ["mac10.9/"] 216 "mac10.10/": ["mac10.9/"]
210 "mac10.9/", "retina/": [] 217 "mac10.9/", "retina/": []
218
219 Args:
220 path_to_rebaseline: The absolute path to a baseline directory.
221
222 Returns:
223 A list of directory names (not full paths) of directories that are
224 "immediate predecessors" of the given baseline path.
211 """ 225 """
212 port_names = self._tool.port_factory.all_port_names() 226 port_names = self._tool.port_factory.all_port_names()
213 immediate_predecessors = [] 227 immediate_predecessors = []
214 for port_name in port_names: 228 for port_name in port_names:
215 port = self._tool.port_factory.get(port_name) 229 port = self._tool.port_factory.get(port_name)
216 baseline_search_path = port.baseline_search_path() 230 baseline_search_path = port.baseline_search_path()
217 try: 231 try:
218 index = baseline_search_path.index(path_to_rebaseline) 232 index = baseline_search_path.index(path_to_rebaseline)
219 if index: 233 if index:
220 immediate_predecessors.append(self._tool.filesystem.basename (baseline_search_path[index - 1])) 234 immediate_predecessors.append(self._tool.filesystem.basename (baseline_search_path[index - 1]))
221 except ValueError: 235 except ValueError:
222 # baseline_search_path.index() throws a ValueError if the item i sn't in the list. 236 # baseline_search_path.index() throws a ValueError if the item i sn't in the list.
223 pass 237 pass
224 return immediate_predecessors 238 return immediate_predecessors
225 239
226 def _port_for_primary_baseline(self, baseline): 240 def _port_for_primary_baseline(self, baseline):
227 """Returns a Port object for the given baseline directory base name.""" 241 """Returns a Port object for the given baseline directory base name."""
228 for port in [self._tool.port_factory.get(port_name) for port_name in sel f._tool.port_factory.all_port_names()]: 242 for port in [self._tool.port_factory.get(port_name) for port_name in sel f._tool.port_factory.all_port_names()]:
229 if self._tool.filesystem.basename(port.baseline_version_dir()) == ba seline: 243 if self._tool.filesystem.basename(port.baseline_version_dir()) == ba seline:
230 return port 244 return port
231 raise Exception('Failed to find port for primary baseline %s.' % baselin e) 245 raise Exception('Failed to find port for primary baseline %s.' % baselin e)
232 246
233 def _copy_existing_baseline(self, builder_name, test_name, suffix): 247 def _copy_existing_baseline(self, port_name, test_name, suffix):
234 """Copies the baseline for the given builder to all "predecessor" direct ories.""" 248 """Copies the baseline for the given builder to all "predecessor" direct ories."""
235 baseline_directory = self._baseline_directory(builder_name) 249 baseline_directory = self._tool.port_factory.get(port_name).baseline_ver sion_dir()
236 ports = [self._port_for_primary_baseline(baseline) 250 ports = [self._port_for_primary_baseline(baseline)
237 for baseline in self._immediate_predecessors_in_fallback(baseli ne_directory)] 251 for baseline in self._immediate_predecessors_in_fallback(baseli ne_directory)]
238 252
239 old_baselines = [] 253 old_baselines = []
240 new_baselines = [] 254 new_baselines = []
241 255
242 # Need to gather all the baseline paths before modifying the filesystem since 256 # Need to gather all the baseline paths before modifying the filesystem since
243 # the modifications can affect the results of port.expected_filename. 257 # the modifications can affect the results of port.expected_filename.
244 for port in ports: 258 for port in ports:
245 old_baseline = port.expected_filename(test_name, '.' + suffix) 259 old_baseline = port.expected_filename(test_name, '.' + suffix)
(...skipping 24 matching lines...) Expand all
270 for i in range(len(old_baselines)): 284 for i in range(len(old_baselines)):
271 old_baseline = old_baselines[i] 285 old_baseline = old_baselines[i]
272 new_baseline = new_baselines[i] 286 new_baseline = new_baselines[i]
273 287
274 _log.debug('Copying baseline from %s to %s.', old_baseline, new_base line) 288 _log.debug('Copying baseline from %s to %s.', old_baseline, new_base line)
275 self._tool.filesystem.maybe_make_directory(self._tool.filesystem.dir name(new_baseline)) 289 self._tool.filesystem.maybe_make_directory(self._tool.filesystem.dir name(new_baseline))
276 self._tool.filesystem.copyfile(old_baseline, new_baseline) 290 self._tool.filesystem.copyfile(old_baseline, new_baseline)
277 291
278 def execute(self, options, args, tool): 292 def execute(self, options, args, tool):
279 self._tool = tool 293 self._tool = tool
294 port_name = options.port_name
280 for suffix in options.suffixes.split(','): 295 for suffix in options.suffixes.split(','):
281 self._copy_existing_baseline(options.builder, options.test, suffix) 296 self._copy_existing_baseline(port_name, options.test, suffix)
282 297
283 298
284 class RebaselineTest(AbstractRebaseliningCommand): 299 class RebaselineTest(AbstractRebaseliningCommand):
285 name = 'rebaseline-test-internal' 300 name = 'rebaseline-test-internal'
286 help_text = 'Rebaseline a single test from a buildbot. Only intended for use by other webkit-patch commands.' 301 help_text = 'Rebaseline a single test from a buildbot. Only intended for use by other webkit-patch commands.'
287 302
288 def __init__(self): 303 def __init__(self):
289 super(RebaselineTest, self).__init__(options=[ 304 super(RebaselineTest, self).__init__(options=[
305 self.test_option,
306 self.suffixes_option,
307 self.port_name_option,
308 self.builder_option,
309 self.build_number_option,
290 self.results_directory_option, 310 self.results_directory_option,
291 self.suffixes_option,
292 self.builder_option,
293 self.test_option,
294 self.build_number_option,
295 ]) 311 ])
296 312
297 def _save_baseline(self, data, target_baseline): 313 def _save_baseline(self, data, target_baseline):
298 if not data: 314 if not data:
299 _log.debug('No baseline data to save.') 315 _log.debug('No baseline data to save.')
300 return 316 return
301 317
302 filesystem = self._tool.filesystem 318 filesystem = self._tool.filesystem
303 filesystem.maybe_make_directory(filesystem.dirname(target_baseline)) 319 filesystem.maybe_make_directory(filesystem.dirname(target_baseline))
304 filesystem.write_binary_file(target_baseline, data) 320 filesystem.write_binary_file(target_baseline, data)
305 321
306 def _rebaseline_test(self, builder_name, test_name, suffix, results_url): 322 def _rebaseline_test(self, port_name, test_name, suffix, results_url):
307 baseline_directory = self._baseline_directory(builder_name) 323 """Downloads a baseline file and saves it to the filesystem.
324
325 Args:
326 port_name: The port that the baseline is for. This determines
327 the directory that the baseline is saved to.
328 test_name: The name of the test being rebaselined.
329 suffix: The baseline file extension (e.g. png); together with the
330 test name and results_url this determines what file to download.
331 results_url: Base URL to download the actual result from.
332 """
333 baseline_directory = self._tool.port_factory.get(port_name).baseline_ver sion_dir()
308 334
309 source_baseline = '%s/%s' % (results_url, self._file_name_for_actual_res ult(test_name, suffix)) 335 source_baseline = '%s/%s' % (results_url, self._file_name_for_actual_res ult(test_name, suffix))
310 target_baseline = self._tool.filesystem.join(baseline_directory, self._f ile_name_for_expected_result(test_name, suffix)) 336 target_baseline = self._tool.filesystem.join(baseline_directory, self._f ile_name_for_expected_result(test_name, suffix))
311 337
312 _log.debug('Retrieving source %s for target %s.', source_baseline, targe t_baseline) 338 _log.debug('Retrieving source %s for target %s.', source_baseline, targe t_baseline)
313 self._save_baseline(self._tool.web.get_binary(source_baseline, return_no ne_on_404=True), 339 self._save_baseline(self._tool.web.get_binary(source_baseline, return_no ne_on_404=True),
314 target_baseline) 340 target_baseline)
315 341
316 def _rebaseline_test_and_update_expectations(self, options): 342 def _rebaseline_test_and_update_expectations(self, options):
317 self._baseline_suffix_list = options.suffixes.split(',') 343 self._baseline_suffix_list = options.suffixes.split(',')
318 344
319 port = self._tool.port_factory.get_from_builder_name(options.builder) 345 port_name = options.port_name or self._tool.builders.port_name_for_build er_name(options.builder)
346 port = self._tool.port_factory.get(port_name)
347
320 if port.reference_files(options.test): 348 if port.reference_files(options.test):
321 if 'png' in self._baseline_suffix_list: 349 if 'png' in self._baseline_suffix_list:
322 _log.warning('Cannot rebaseline image result for reftest: %s', o ptions.test) 350 _log.warning('Cannot rebaseline image result for reftest: %s', o ptions.test)
323 return 351 return
324 assert self._baseline_suffix_list == ['txt'] 352 assert self._baseline_suffix_list == ['txt']
325 353
326 if options.results_directory: 354 if options.results_directory:
327 results_url = 'file://' + options.results_directory 355 results_url = 'file://' + options.results_directory
328 else: 356 else:
329 results_url = self._tool.buildbot.results_url(options.builder, build _number=options.build_number) 357 results_url = self._tool.buildbot.results_url(options.builder, build _number=options.build_number)
330 358
331 for suffix in self._baseline_suffix_list: 359 for suffix in self._baseline_suffix_list:
332 self._rebaseline_test(options.builder, options.test, suffix, results _url) 360 self._rebaseline_test(port_name, options.test, suffix, results_url)
333 self.expectation_line_changes.remove_line(test=options.test, builder=opt ions.builder) 361 self.expectation_line_changes.remove_line(test=options.test, port_name=p ort_name)
334 362
335 def execute(self, options, args, tool): 363 def execute(self, options, args, tool):
336 self._tool = tool 364 self._tool = tool
337 self._rebaseline_test_and_update_expectations(options) 365 self._rebaseline_test_and_update_expectations(options)
338 self._print_expectation_line_changes() 366 self._print_expectation_line_changes()
339 367
340 368
341 class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand): 369 class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
342 """Base class for rebaseline commands that do some tasks in parallel.""" 370 """Base class for rebaseline commands that do some tasks in parallel."""
343 # Not overriding execute() - pylint: disable=abstract-method 371 # Not overriding execute() - pylint: disable=abstract-method
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 cwd = self._tool.git().checkout_root 435 cwd = self._tool.git().checkout_root
408 copy_baseline_commands = [] 436 copy_baseline_commands = []
409 rebaseline_commands = [] 437 rebaseline_commands = []
410 lines_to_remove = {} 438 lines_to_remove = {}
411 439
412 builders_to_fetch_from = self._builders_to_fetch_from(test_baseline_set. all_builders()) 440 builders_to_fetch_from = self._builders_to_fetch_from(test_baseline_set. all_builders())
413 for test, build in test_baseline_set: 441 for test, build in test_baseline_set:
414 if build.builder_name not in builders_to_fetch_from: 442 if build.builder_name not in builders_to_fetch_from:
415 continue 443 continue
416 444
445 port_name = self._tool.builders.port_name_for_builder_name(build.bui lder_name)
446
417 suffixes = self._suffixes_for_actual_failures(test, build) 447 suffixes = self._suffixes_for_actual_failures(test, build)
418 if not suffixes: 448 if not suffixes:
419 # If we're not going to rebaseline the test because it's passing on this 449 # If we're not going to rebaseline the test because it's passing on this
420 # builder, we still want to remove the line from TestExpectation s. 450 # builder, we still want to remove the line from TestExpectation s.
421 if test not in lines_to_remove: 451 if test not in lines_to_remove:
422 lines_to_remove[test] = [] 452 lines_to_remove[test] = []
423 lines_to_remove[test].append(build.builder_name) 453 lines_to_remove[test].append(port_name)
424 continue 454 continue
425 455
426 args = ['--suffixes', ','.join(suffixes), '--builder', build.builder _name, '--test', test] 456 args = []
427 if options.verbose: 457 if options.verbose:
428 args.append('--verbose') 458 args.append('--verbose')
459 args.extend([
460 '--test', test,
461 '--suffixes', ','.join(suffixes),
462 '--port-name', port_name,
463 ])
429 464
430 copy_command = [self._tool.executable, path_to_webkit_patch, 'copy-e xisting-baselines-internal'] + args 465 copy_command = [self._tool.executable, path_to_webkit_patch, 'copy-e xisting-baselines-internal'] + args
431 copy_baseline_commands.append(tuple([copy_command, cwd])) 466 copy_baseline_commands.append(tuple([copy_command, cwd]))
432 467
468 args.extend(['--builder', build.builder_name])
433 if build.build_number: 469 if build.build_number:
434 args.extend(['--build-number', str(build.build_number)]) 470 args.extend(['--build-number', str(build.build_number)])
435 if options.results_directory: 471 if options.results_directory:
436 args.extend(['--results-directory', options.results_directory]) 472 args.extend(['--results-directory', options.results_directory])
437 473
438 rebaseline_command = [self._tool.executable, path_to_webkit_patch, ' rebaseline-test-internal'] + args 474 rebaseline_command = [self._tool.executable, path_to_webkit_patch, ' rebaseline-test-internal'] + args
439 rebaseline_commands.append(tuple([rebaseline_command, cwd])) 475 rebaseline_commands.append(tuple([rebaseline_command, cwd]))
440 476
441 return copy_baseline_commands, rebaseline_commands, lines_to_remove 477 return copy_baseline_commands, rebaseline_commands, lines_to_remove
442 478
(...skipping 23 matching lines...) Expand all
466 if build.builder_name not in builders_to_fetch_from: 502 if build.builder_name not in builders_to_fetch_from:
467 continue 503 continue
468 tests_to_suffixes[test].update(self._suffixes_for_actual_failures(te st, build)) 504 tests_to_suffixes[test].update(self._suffixes_for_actual_failures(te st, build))
469 505
470 optimize_commands = [] 506 optimize_commands = []
471 for test, suffixes in tests_to_suffixes.iteritems(): 507 for test, suffixes in tests_to_suffixes.iteritems():
472 # No need to optimize baselines for a test with no failures. 508 # No need to optimize baselines for a test with no failures.
473 if not suffixes: 509 if not suffixes:
474 continue 510 continue
475 # FIXME: We should propagate the platform options as well. 511 # FIXME: We should propagate the platform options as well.
476 args = ['--suffixes', ','.join(suffixes), test] 512 args = []
477 if verbose: 513 if verbose:
478 args.append('--verbose') 514 args.append('--verbose')
515 args.extend(['--suffixes', ','.join(suffixes), test])
479 path_to_webkit_patch = self._tool.path() 516 path_to_webkit_patch = self._tool.path()
480 cwd = self._tool.git().checkout_root 517 cwd = self._tool.git().checkout_root
481 command = [self._tool.executable, path_to_webkit_patch, 'optimize-ba selines'] + args 518 command = [self._tool.executable, path_to_webkit_patch, 'optimize-ba selines'] + args
482 optimize_commands.append(tuple([command, cwd])) 519 optimize_commands.append(tuple([command, cwd]))
483 520
484 return optimize_commands 521 return optimize_commands
485 522
486 def _update_expectations_files(self, lines_to_remove): 523 def _update_expectations_files(self, lines_to_remove):
487 # FIXME: This routine is way too expensive. We're creating O(n ports) Te stExpectations objects. 524 # FIXME: This routine is way too expensive. We're creating O(n ports) Te stExpectations objects.
488 # This is slow and uses a lot of memory. 525 # This is slow and uses a lot of memory.
489 tests = lines_to_remove.keys() 526 tests = lines_to_remove.keys()
490 to_remove = [] 527 to_remove = []
491 528
492 # This is so we remove lines for builders that skip this test, e.g. Andr oid skips most 529 # This is so we remove lines for builders that skip this test, e.g. Andr oid skips most
493 # tests and we don't want to leave stray [ Android ] lines in TestExpect ations.. 530 # tests and we don't want to leave stray [ Android ] lines in TestExpect ations..
494 # This is only necessary for "webkit-patch rebaseline" and for rebaselin ing expected 531 # This is only necessary for "webkit-patch rebaseline" and for rebaselin ing expected
495 # failures from garden-o-matic. rebaseline-expectations and auto-rebasel ine will always 532 # failures from garden-o-matic. rebaseline-expectations and auto-rebasel ine will always
496 # pass the exact set of ports to rebaseline. 533 # pass the exact set of ports to rebaseline.
497 for port_name in self._tool.port_factory.all_port_names(): 534 for port_name in self._tool.port_factory.all_port_names():
498 port = self._tool.port_factory.get(port_name) 535 port = self._tool.port_factory.get(port_name)
499 generic_expectations = TestExpectations(port, tests=tests, include_o verrides=False) 536 generic_expectations = TestExpectations(port, tests=tests, include_o verrides=False)
500 full_expectations = TestExpectations(port, tests=tests, include_over rides=True) 537 full_expectations = TestExpectations(port, tests=tests, include_over rides=True)
501 for test in tests: 538 for test in tests:
502 if port.skips_test(test, generic_expectations, full_expectations ): 539 if port.skips_test(test, generic_expectations, full_expectations ):
503 for test_configuration in port.all_test_configurations(): 540 for test_configuration in port.all_test_configurations():
504 if test_configuration.version == port.test_configuration ().version: 541 if test_configuration.version == port.test_configuration ().version:
505 to_remove.append((test, test_configuration)) 542 to_remove.append((test, test_configuration))
506 543
507 for test in lines_to_remove: 544 for test in lines_to_remove:
508 for builder in lines_to_remove[test]: 545 for port_name in lines_to_remove[test]:
509 port = self._tool.port_factory.get_from_builder_name(builder) 546 port = self._tool.port_factory.get(port_name)
510 for test_configuration in port.all_test_configurations(): 547 for test_configuration in port.all_test_configurations():
511 if test_configuration.version == port.test_configuration().v ersion: 548 if test_configuration.version == port.test_configuration().v ersion:
512 to_remove.append((test, test_configuration)) 549 to_remove.append((test, test_configuration))
513 550
514 port = self._tool.port_factory.get() 551 port = self._tool.port_factory.get()
515 expectations = TestExpectations(port, include_overrides=False) 552 expectations = TestExpectations(port, include_overrides=False)
516 expectations_string = expectations.remove_configurations(to_remove) 553 expectations_string = expectations.remove_configurations(to_remove)
517 path = port.path_to_generic_test_expectations_file() 554 path = port.path_to_generic_test_expectations_file()
518 self._tool.filesystem.write_text_file(path, expectations_string) 555 self._tool.filesystem.write_text_file(path, expectations_string)
519 556
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 755
719 test_baseline_set = TestBaselineSet(tool) 756 test_baseline_set = TestBaselineSet(tool)
720 757
721 for builder in builders_to_check: 758 for builder in builders_to_check:
722 for test_prefix in args: 759 for test_prefix in args:
723 test_baseline_set.add(test_prefix, Build(builder)) 760 test_baseline_set.add(test_prefix, Build(builder))
724 761
725 _log.debug('Rebaselining: %s', test_baseline_set) 762 _log.debug('Rebaselining: %s', test_baseline_set)
726 763
727 self.rebaseline(options, test_baseline_set) 764 self.rebaseline(options, test_baseline_set)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698