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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 self._scm_changes['remove-lines'].append({'builder': options.builder, 't
est': options.test}) | 220 self._scm_changes['remove-lines'].append({'builder': options.builder, 't
est': options.test}) |
221 | 221 |
222 def execute(self, options, args, tool): | 222 def execute(self, options, args, tool): |
223 self._rebaseline_test_and_update_expectations(options) | 223 self._rebaseline_test_and_update_expectations(options) |
224 print json.dumps(self._scm_changes) | 224 print json.dumps(self._scm_changes) |
225 | 225 |
226 | 226 |
227 class OptimizeBaselines(AbstractRebaseliningCommand): | 227 class OptimizeBaselines(AbstractRebaseliningCommand): |
228 name = "optimize-baselines" | 228 name = "optimize-baselines" |
229 help_text = "Reshuffles the baselines for the given tests to use as litte sp
ace on disk as possible." | 229 help_text = "Reshuffles the baselines for the given tests to use as litte sp
ace on disk as possible." |
| 230 show_in_main_help = True |
230 argument_names = "TEST_NAMES" | 231 argument_names = "TEST_NAMES" |
231 | 232 |
232 def __init__(self): | 233 def __init__(self): |
233 super(OptimizeBaselines, self).__init__(options=[self.suffixes_option] +
self.platform_options) | 234 super(OptimizeBaselines, self).__init__(options=[self.suffixes_option] +
self.platform_options) |
234 | 235 |
235 def _optimize_baseline(self, optimizer, test_name): | 236 def _optimize_baseline(self, optimizer, test_name): |
236 for suffix in self._baseline_suffix_list: | 237 for suffix in self._baseline_suffix_list: |
237 baseline_name = _baseline_name(self._tool.filesystem, test_name, suf
fix) | 238 baseline_name = _baseline_name(self._tool.filesystem, test_name, suf
fix) |
238 if not optimizer.optimize(baseline_name): | 239 if not optimizer.optimize(baseline_name): |
239 print "Heuristics failed to optimize %s" % baseline_name | 240 print "Heuristics failed to optimize %s" % baseline_name |
240 | 241 |
241 def execute(self, options, args, tool): | 242 def execute(self, options, args, tool): |
242 self._baseline_suffix_list = options.suffixes.split(',') | 243 self._baseline_suffix_list = options.suffixes.split(',') |
243 port_names = tool.port_factory.all_port_names(options.platform) | 244 port_names = tool.port_factory.all_port_names(options.platform) |
244 if not port_names: | 245 if not port_names: |
245 print "No port names match '%s'" % options.platform | 246 print "No port names match '%s'" % options.platform |
246 return | 247 return |
247 | 248 |
248 optimizer = BaselineOptimizer(tool, port_names) | 249 optimizer = BaselineOptimizer(tool, port_names) |
249 port = tool.port_factory.get(port_names[0]) | 250 port = tool.port_factory.get(port_names[0]) |
250 for test_name in port.tests(args): | 251 for test_name in port.tests(args): |
251 _log.info("Optimizing %s" % test_name) | 252 _log.info("Optimizing %s" % test_name) |
252 self._optimize_baseline(optimizer, test_name) | 253 self._optimize_baseline(optimizer, test_name) |
253 | 254 |
254 | 255 |
255 class AnalyzeBaselines(AbstractRebaseliningCommand): | 256 class AnalyzeBaselines(AbstractRebaseliningCommand): |
256 name = "analyze-baselines" | 257 name = "analyze-baselines" |
257 help_text = "Analyzes the baselines for the given tests and prints results t
hat are identical." | 258 help_text = "Analyzes the baselines for the given tests and prints results t
hat are identical." |
| 259 show_in_main_help = True |
258 argument_names = "TEST_NAMES" | 260 argument_names = "TEST_NAMES" |
259 | 261 |
260 def __init__(self): | 262 def __init__(self): |
261 super(AnalyzeBaselines, self).__init__(options=[ | 263 super(AnalyzeBaselines, self).__init__(options=[ |
262 self.suffixes_option, | 264 self.suffixes_option, |
263 optparse.make_option('--missing', action='store_true', default=False
, help='show missing baselines as well'), | 265 optparse.make_option('--missing', action='store_true', default=False
, help='show missing baselines as well'), |
264 ] + self.platform_options) | 266 ] + self.platform_options) |
265 self._optimizer_class = BaselineOptimizer # overridable for testing | 267 self._optimizer_class = BaselineOptimizer # overridable for testing |
266 self._baseline_optimizer = None | 268 self._baseline_optimizer = None |
267 self._port = None | 269 self._port = None |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 self.results_directory_option, | 487 self.results_directory_option, |
486 ]) | 488 ]) |
487 | 489 |
488 def execute(self, options, args, tool): | 490 def execute(self, options, args, tool): |
489 self._rebaseline(options, json.loads(sys.stdin.read())) | 491 self._rebaseline(options, json.loads(sys.stdin.read())) |
490 | 492 |
491 | 493 |
492 class RebaselineExpectations(AbstractParallelRebaselineCommand): | 494 class RebaselineExpectations(AbstractParallelRebaselineCommand): |
493 name = "rebaseline-expectations" | 495 name = "rebaseline-expectations" |
494 help_text = "Rebaselines the tests indicated in TestExpectations." | 496 help_text = "Rebaselines the tests indicated in TestExpectations." |
| 497 show_in_main_help = True |
495 | 498 |
496 def __init__(self): | 499 def __init__(self): |
497 super(RebaselineExpectations, self).__init__(options=[ | 500 super(RebaselineExpectations, self).__init__(options=[ |
498 self.no_optimize_option, | 501 self.no_optimize_option, |
499 ] + self.platform_options) | 502 ] + self.platform_options) |
500 self._test_prefix_list = None | 503 self._test_prefix_list = None |
501 | 504 |
502 def _tests_to_rebaseline(self, port): | 505 def _tests_to_rebaseline(self, port): |
503 tests_to_rebaseline = {} | 506 tests_to_rebaseline = {} |
504 for path, value in port.expectations_dict().items(): | 507 for path, value in port.expectations_dict().items(): |
(...skipping 27 matching lines...) Expand all Loading... |
532 if not self._test_prefix_list: | 535 if not self._test_prefix_list: |
533 _log.warning("Did not find any tests marked Rebaseline.") | 536 _log.warning("Did not find any tests marked Rebaseline.") |
534 return | 537 return |
535 | 538 |
536 self._rebaseline(options, self._test_prefix_list) | 539 self._rebaseline(options, self._test_prefix_list) |
537 | 540 |
538 | 541 |
539 class Rebaseline(AbstractParallelRebaselineCommand): | 542 class Rebaseline(AbstractParallelRebaselineCommand): |
540 name = "rebaseline" | 543 name = "rebaseline" |
541 help_text = "Rebaseline tests with results from the build bots. Shows the li
st of failing tests on the builders if no test names are provided." | 544 help_text = "Rebaseline tests with results from the build bots. Shows the li
st of failing tests on the builders if no test names are provided." |
| 545 show_in_main_help = True |
542 argument_names = "[TEST_NAMES]" | 546 argument_names = "[TEST_NAMES]" |
543 | 547 |
544 def __init__(self): | 548 def __init__(self): |
545 super(Rebaseline, self).__init__(options=[ | 549 super(Rebaseline, self).__init__(options=[ |
546 self.no_optimize_option, | 550 self.no_optimize_option, |
547 # FIXME: should we support the platform options in addition to (or i
nstead of) --builders? | 551 # FIXME: should we support the platform options in addition to (or i
nstead of) --builders? |
548 self.suffixes_option, | 552 self.suffixes_option, |
549 self.results_directory_option, | 553 self.results_directory_option, |
550 optparse.make_option("--builders", default=None, action="append", he
lp="Comma-separated-list of builders to pull new baselines from (can also be pro
vided multiple times)"), | 554 optparse.make_option("--builders", default=None, action="append", he
lp="Comma-separated-list of builders to pull new baselines from (can also be pro
vided multiple times)"), |
551 ]) | 555 ]) |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 finally: | 838 finally: |
835 self._run_git_cl_command(options, ['set_close']) | 839 self._run_git_cl_command(options, ['set_close']) |
836 tool.scm().ensure_cleanly_tracking_remote_master() | 840 tool.scm().ensure_cleanly_tracking_remote_master() |
837 tool.scm().checkout_branch(old_branch_name) | 841 tool.scm().checkout_branch(old_branch_name) |
838 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) | 842 tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) |
839 | 843 |
840 | 844 |
841 class RebaselineOMatic(AbstractDeclarativeCommand): | 845 class RebaselineOMatic(AbstractDeclarativeCommand): |
842 name = "rebaseline-o-matic" | 846 name = "rebaseline-o-matic" |
843 help_text = "Calls webkit-patch auto-rebaseline in a loop." | 847 help_text = "Calls webkit-patch auto-rebaseline in a loop." |
| 848 show_in_main_help = True |
844 | 849 |
845 SLEEP_TIME_IN_SECONDS = 30 | 850 SLEEP_TIME_IN_SECONDS = 30 |
846 | 851 |
847 def execute(self, options, args, tool): | 852 def execute(self, options, args, tool): |
848 while True: | 853 while True: |
849 try: | 854 try: |
850 tool.executive.run_command(['git', 'pull']) | 855 tool.executive.run_command(['git', 'pull']) |
851 rebaseline_command = [tool.filesystem.join(tool.scm().checkout_r
oot, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline', '--log-server', 'bl
inkrebaseline.appspot.com'] | 856 rebaseline_command = [tool.filesystem.join(tool.scm().checkout_r
oot, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline', '--log-server', 'bl
inkrebaseline.appspot.com'] |
852 if options.verbose: | 857 if options.verbose: |
853 rebaseline_command.append('--verbose') | 858 rebaseline_command.append('--verbose') |
854 # Use call instead of run_command so that stdout doesn't get swa
llowed. | 859 # Use call instead of run_command so that stdout doesn't get swa
llowed. |
855 tool.executive.call(rebaseline_command) | 860 tool.executive.call(rebaseline_command) |
856 except: | 861 except: |
857 traceback.print_exc(file=sys.stderr) | 862 traceback.print_exc(file=sys.stderr) |
858 | 863 |
859 time.sleep(self.SLEEP_TIME_IN_SECONDS) | 864 time.sleep(self.SLEEP_TIME_IN_SECONDS) |
OLD | NEW |