OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Run Performance Test Bisect Tool | 6 """Run Performance Test Bisect Tool |
7 | 7 |
8 This script is used by a try bot to run the bisect script with the parameters | 8 This script is used by a try bot to run the bisect script with the parameters |
9 specified in the bisect config file. It checks out a copy of the depot in | 9 specified in the bisect config file. It checks out a copy of the depot in |
10 a subdirectory 'bisect' of the working directory provided, annd runs the | 10 a subdirectory 'bisect' of the working directory provided, annd runs the |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 The parameters checked are the required parameters; any additional optional | 142 The parameters checked are the required parameters; any additional optional |
143 parameters won't be checked and validation will still pass. | 143 parameters won't be checked and validation will still pass. |
144 | 144 |
145 Args: | 145 Args: |
146 config_contents: A config dictionary. | 146 config_contents: A config dictionary. |
147 | 147 |
148 Returns: | 148 Returns: |
149 True if valid. | 149 True if valid. |
150 """ | 150 """ |
151 required_parameters = [ | 151 return _ValidateConfigFile(config_contents, required_parameters=['command']) |
152 'command', | |
153 'repeat_count', | |
154 'truncate_percent', | |
155 'max_time_minutes', | |
156 ] | |
157 return _ValidateConfigFile(config_contents, required_parameters) | |
158 | 152 |
159 | 153 |
160 def _ValidateBisectConfigFile(config_contents): | 154 def _ValidateBisectConfigFile(config_contents): |
161 """Validates the bisect config file contents. | 155 """Validates the bisect config file contents. |
162 | 156 |
163 The parameters checked are the required parameters; any additional optional | 157 The parameters checked are the required parameters; any additional optional |
164 parameters won't be checked and validation will still pass. | 158 parameters won't be checked and validation will still pass. |
165 | 159 |
166 Args: | 160 Args: |
167 config_contents: A config dictionary. | 161 config_contents: A config dictionary. |
168 | 162 |
169 Returns: | 163 Returns: |
170 True if valid. | 164 True if valid. |
171 """ | 165 """ |
172 required_params = [ | 166 return _ValidateConfigFile( |
173 'command', | 167 config_contents, |
174 'good_revision', | 168 required_parameters=['command', 'good_revision', 'bad_revision']) |
175 'bad_revision', | |
176 'metric', | |
177 'repeat_count', | |
178 'truncate_percent', | |
179 'max_time_minutes', | |
180 ] | |
181 return _ValidateConfigFile(config_contents, required_params) | |
182 | 169 |
183 | 170 |
184 def _OutputFailedResults(text_to_print): | 171 def _OutputFailedResults(text_to_print): |
185 bisect_utils.OutputAnnotationStepStart('Results - Failed') | 172 bisect_utils.OutputAnnotationStepStart('Results - Failed') |
186 print | 173 print |
187 print text_to_print | 174 print text_to_print |
188 print | 175 print |
189 bisect_utils.OutputAnnotationStepClosed() | 176 bisect_utils.OutputAnnotationStepClosed() |
190 | 177 |
191 | 178 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 """ | 478 """ |
492 _PrintConfigStep(config) | 479 _PrintConfigStep(config) |
493 | 480 |
494 # Construct the basic command with all necessary arguments. | 481 # Construct the basic command with all necessary arguments. |
495 cmd = [ | 482 cmd = [ |
496 'python', | 483 'python', |
497 os.path.join(BISECT_SCRIPT_DIR, 'bisect_perf_regression.py'), | 484 os.path.join(BISECT_SCRIPT_DIR, 'bisect_perf_regression.py'), |
498 '--command', config['command'], | 485 '--command', config['command'], |
499 '--good_revision', config['good_revision'], | 486 '--good_revision', config['good_revision'], |
500 '--bad_revision', config['bad_revision'], | 487 '--bad_revision', config['bad_revision'], |
501 '--metric', config['metric'], | |
502 '--working_directory', working_directory, | 488 '--working_directory', working_directory, |
503 '--output_buildbot_annotations' | 489 '--output_buildbot_annotations' |
504 ] | 490 ] |
505 | 491 |
506 # Add flags for any optional config parameters if given in the config. | 492 # Add flags for any optional config parameters if given in the config. |
507 options = [ | 493 options = [ |
| 494 ('metric', '--metric'), |
508 ('repeat_count', '--repeat_test_count'), | 495 ('repeat_count', '--repeat_test_count'), |
509 ('truncate_percent', '--truncate_percent'), | 496 ('truncate_percent', '--truncate_percent'), |
510 ('max_time_minutes', '--max_time_minutes'), | 497 ('max_time_minutes', '--max_time_minutes'), |
511 ('bisect_mode', '--bisect_mode'), | 498 ('bisect_mode', '--bisect_mode'), |
512 ('improvement_direction', '--improvement_direction'), | 499 ('improvement_direction', '--improvement_direction'), |
513 ('bug_id', '--bug_id'), | 500 ('bug_id', '--bug_id'), |
514 ('builder_type', '--builder_type'), | 501 ('builder_type', '--builder_type'), |
515 ] | 502 ] |
516 for config_key, flag in options: | 503 for config_key, flag in options: |
517 if config.has_key(config_key): | 504 if config.has_key(config_key): |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 if config and config_is_valid: | 640 if config and config_is_valid: |
654 return _SetupAndRunPerformanceTest(config, opts.path_to_goma) | 641 return _SetupAndRunPerformanceTest(config, opts.path_to_goma) |
655 | 642 |
656 print ('Error: Could not load config file. Double check your changes to ' | 643 print ('Error: Could not load config file. Double check your changes to ' |
657 'auto_bisect/bisect.cfg or run-perf-test.cfg for syntax errors.\n') | 644 'auto_bisect/bisect.cfg or run-perf-test.cfg for syntax errors.\n') |
658 return 1 | 645 return 1 |
659 | 646 |
660 | 647 |
661 if __name__ == '__main__': | 648 if __name__ == '__main__': |
662 sys.exit(main()) | 649 sys.exit(main()) |
OLD | NEW |