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

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

Powered by Google App Engine
This is Rietveld 408576698