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

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

Issue 2679173005: Rename Host.scm -> Host.git. (Closed)
Patch Set: Created 3 years, 10 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 for builder_name in self._tool.builders.all_continuous_builder_names(): 293 for builder_name in self._tool.builders.all_continuous_builder_names():
294 port = self._tool.port_factory.get_from_builder_name(builder_name) 294 port = self._tool.port_factory.get_from_builder_name(builder_name)
295 if port.test_configuration().build_type == 'release': 295 if port.test_configuration().build_type == 'release':
296 release_builders.append(builder_name) 296 release_builders.append(builder_name)
297 return release_builders 297 return release_builders
298 298
299 def _run_webkit_patch(self, args, verbose): 299 def _run_webkit_patch(self, args, verbose):
300 try: 300 try:
301 verbose_args = ['--verbose'] if verbose else [] 301 verbose_args = ['--verbose'] if verbose else []
302 stderr = self._tool.executive.run_command([self._tool.path()] + verb ose_args + 302 stderr = self._tool.executive.run_command([self._tool.path()] + verb ose_args +
303 args, cwd=self._tool.scm() .checkout_root, return_stderr=True) 303 args, cwd=self._tool.git() .checkout_root, return_stderr=True)
304 for line in stderr.splitlines(): 304 for line in stderr.splitlines():
305 _log.warning(line) 305 _log.warning(line)
306 except ScriptError: 306 except ScriptError:
307 traceback.print_exc(file=sys.stderr) 307 traceback.print_exc(file=sys.stderr)
308 308
309 def _builders_to_fetch_from(self, builders_to_check): 309 def _builders_to_fetch_from(self, builders_to_check):
310 """Returns the subset of builders that will cover all of the baseline 310 """Returns the subset of builders that will cover all of the baseline
311 search paths used in the input list. 311 search paths used in the input list.
312 312
313 In particular, if the input list contains both Release and Debug 313 In particular, if the input list contains both Release and Debug
(...skipping 20 matching lines...) Expand all
334 return builders_to_fallback_paths.keys() 334 return builders_to_fallback_paths.keys()
335 335
336 @staticmethod 336 @staticmethod
337 def _builder_names(builds): 337 def _builder_names(builds):
338 # TODO(qyearsley): If test_prefix_list dicts are converted to instances 338 # TODO(qyearsley): If test_prefix_list dicts are converted to instances
339 # of some class, then this could be replaced with a method on that clas s. 339 # of some class, then this could be replaced with a method on that clas s.
340 return [b.builder_name for b in builds] 340 return [b.builder_name for b in builds]
341 341
342 def _rebaseline_commands(self, test_prefix_list, options): 342 def _rebaseline_commands(self, test_prefix_list, options):
343 path_to_webkit_patch = self._tool.path() 343 path_to_webkit_patch = self._tool.path()
344 cwd = self._tool.scm().checkout_root 344 cwd = self._tool.git().checkout_root
345 copy_baseline_commands = [] 345 copy_baseline_commands = []
346 rebaseline_commands = [] 346 rebaseline_commands = []
347 lines_to_remove = {} 347 lines_to_remove = {}
348 port = self._tool.port_factory.get() 348 port = self._tool.port_factory.get()
349 349
350 for test_prefix in test_prefix_list: 350 for test_prefix in test_prefix_list:
351 for test in port.tests([test_prefix]): 351 for test in port.tests([test_prefix]):
352 builders_to_fetch_from = self._builders_to_fetch_from(self._buil der_names(test_prefix_list[test_prefix])) 352 builders_to_fetch_from = self._builders_to_fetch_from(self._buil der_names(test_prefix_list[test_prefix]))
353 for build in sorted(test_prefix_list[test_prefix]): 353 for build in sorted(test_prefix_list[test_prefix]):
354 builder, build_number = build.builder_name, build.build_numb er 354 builder, build_number = build.builder_name, build.build_numb er
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 # No need to optimize baselines for a test with no failures. 414 # No need to optimize baselines for a test with no failures.
415 if not all_suffixes: 415 if not all_suffixes:
416 continue 416 continue
417 417
418 # FIXME: We should propagate the platform options as well. 418 # FIXME: We should propagate the platform options as well.
419 cmd_line = ['--suffixes', ','.join(all_suffixes), test] 419 cmd_line = ['--suffixes', ','.join(all_suffixes), test]
420 if verbose: 420 if verbose:
421 cmd_line.append('--verbose') 421 cmd_line.append('--verbose')
422 422
423 path_to_webkit_patch = self._tool.path() 423 path_to_webkit_patch = self._tool.path()
424 cwd = self._tool.scm().checkout_root 424 cwd = self._tool.git().checkout_root
425 optimize_commands.append(tuple([[self._tool.executable, path_to_webk it_patch, 'optimize-baselines'] + cmd_line, cwd])) 425 optimize_commands.append(tuple([[self._tool.executable, path_to_webk it_patch, 'optimize-baselines'] + cmd_line, cwd]))
426 return optimize_commands 426 return optimize_commands
427 427
428 def _update_expectations_files(self, lines_to_remove): 428 def _update_expectations_files(self, lines_to_remove):
429 # FIXME: This routine is way too expensive. We're creating O(n ports) Te stExpectations objects. 429 # FIXME: This routine is way too expensive. We're creating O(n ports) Te stExpectations objects.
430 # This is slow and uses a lot of memory. 430 # This is slow and uses a lot of memory.
431 tests = lines_to_remove.keys() 431 tests = lines_to_remove.keys()
432 to_remove = [] 432 to_remove = []
433 433
434 # This is so we remove lines for builders that skip this test, e.g. Andr oid skips most 434 # This is so we remove lines for builders that skip this test, e.g. Andr oid skips most
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 "some/test.html": {Build("builder-1", 412): ["txt"], Build(" builder-2", 100): ["txt"]}, 484 "some/test.html": {Build("builder-1", 412): ["txt"], Build(" builder-2", 100): ["txt"]},
485 "some/other.html": {Build("builder-1", 412): ["txt"]} 485 "some/other.html": {Build("builder-1", 412): ["txt"]}
486 } 486 }
487 This would mean that new text baselines should be downloaded for 487 This would mean that new text baselines should be downloaded for
488 "some/test.html" on both builder-1 (build 412) and builder-2 488 "some/test.html" on both builder-1 (build 412) and builder-2
489 (build 100), and new text baselines should be downloaded for 489 (build 100), and new text baselines should be downloaded for
490 "some/other.html" but only from builder-1. 490 "some/other.html" but only from builder-1.
491 TODO(qyearsley): Replace test_prefix_list everywhere with some 491 TODO(qyearsley): Replace test_prefix_list everywhere with some
492 sort of class that contains the same data. 492 sort of class that contains the same data.
493 """ 493 """
494 if self._tool.scm().has_working_directory_changes(pathspec=self._layout_ tests_dir()): 494 if self._tool.git().has_working_directory_changes(pathspec=self._layout_ tests_dir()):
495 _log.error('There are uncommitted changes in the layout tests direct ory; aborting.') 495 _log.error('There are uncommitted changes in the layout tests direct ory; aborting.')
496 return 496 return
497 497
498 for test, builds_to_check in sorted(test_prefix_list.items()): 498 for test, builds_to_check in sorted(test_prefix_list.items()):
499 _log.info("Rebaselining %s", test) 499 _log.info("Rebaselining %s", test)
500 for build, suffixes in sorted(builds_to_check.items()): 500 for build, suffixes in sorted(builds_to_check.items()):
501 _log.debug(" %s: %s", build, ",".join(suffixes)) 501 _log.debug(" %s: %s", build, ",".join(suffixes))
502 502
503 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel f._rebaseline_commands( 503 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel f._rebaseline_commands(
504 test_prefix_list, options) 504 test_prefix_list, options)
(...skipping 12 matching lines...) Expand all
517 self._update_expectations_files(lines_to_remove) 517 self._update_expectations_files(lines_to_remove)
518 518
519 if options.optimize: 519 if options.optimize:
520 # TODO(wkorman): Consider changing temporary branch to base off of H EAD rather than 520 # TODO(wkorman): Consider changing temporary branch to base off of H EAD rather than
521 # origin/master to ensure we run baseline optimization processes wit h the same code as 521 # origin/master to ensure we run baseline optimization processes wit h the same code as
522 # auto-rebaseline itself. 522 # auto-rebaseline itself.
523 self._run_in_parallel(self._optimize_baselines(test_prefix_list, opt ions.verbose)) 523 self._run_in_parallel(self._optimize_baselines(test_prefix_list, opt ions.verbose))
524 524
525 self._remove_all_pass_testharness_baselines(test_prefix_list) 525 self._remove_all_pass_testharness_baselines(test_prefix_list)
526 526
527 self._tool.scm().add_list(self.unstaged_baselines()) 527 self._tool.git().add_list(self.unstaged_baselines())
528 528
529 def unstaged_baselines(self): 529 def unstaged_baselines(self):
530 """Returns absolute paths for unstaged (including untracked) baselines." "" 530 """Returns absolute paths for unstaged (including untracked) baselines." ""
531 baseline_re = re.compile(r'.*[\\/]LayoutTests[\\/].*-expected\.(txt|png| wav)$') 531 baseline_re = re.compile(r'.*[\\/]LayoutTests[\\/].*-expected\.(txt|png| wav)$')
532 unstaged_changes = self._tool.scm().unstaged_changes() 532 unstaged_changes = self._tool.git().unstaged_changes()
533 return sorted(self._tool.scm().absolute_path(path) for path in unstaged_ changes if re.match(baseline_re, path)) 533 return sorted(self._tool.git().absolute_path(path) for path in unstaged_ changes if re.match(baseline_re, path))
534 534
535 def _remove_all_pass_testharness_baselines(self, test_prefix_list): 535 def _remove_all_pass_testharness_baselines(self, test_prefix_list):
536 """Removes all of the all-PASS baselines for the given builders and test s. 536 """Removes all of the all-PASS baselines for the given builders and test s.
537 537
538 In general, for testharness.js tests, the absence of a baseline 538 In general, for testharness.js tests, the absence of a baseline
539 indicates that the test is expected to pass. When rebaselining, 539 indicates that the test is expected to pass. When rebaselining,
540 new all-PASS baselines may be downloaded, but they should not be kept. 540 new all-PASS baselines may be downloaded, but they should not be kept.
541 """ 541 """
542 filesystem = self._tool.filesystem 542 filesystem = self._tool.filesystem
543 baseline_paths = self._all_baseline_paths(test_prefix_list) 543 baseline_paths = self._all_baseline_paths(test_prefix_list)
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 for test in args: 717 for test in args:
718 if test not in test_prefix_list: 718 if test not in test_prefix_list:
719 test_prefix_list[test] = {} 719 test_prefix_list[test] = {}
720 build = Build(builder) 720 build = Build(builder)
721 test_prefix_list[test][build] = suffixes_to_update 721 test_prefix_list[test][build] = suffixes_to_update
722 722
723 if options.verbose: 723 if options.verbose:
724 _log.debug("rebaseline-json: " + str(test_prefix_list)) 724 _log.debug("rebaseline-json: " + str(test_prefix_list))
725 725
726 self.rebaseline(options, test_prefix_list) 726 self.rebaseline(options, test_prefix_list)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698