| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import argparse | 5 import argparse |
| 6 import os | 6 import os |
| 7 import logging | 7 import logging |
| 8 import platform | 8 import platform |
| 9 import re | 9 import re |
| 10 import subprocess | 10 import subprocess |
| 11 import urllib2 | 11 import urllib2 |
| 12 import json | 12 import json |
| 13 | 13 |
| 14 from core import path_util | 14 from core import path_util |
| 15 | 15 |
| 16 from telemetry import benchmark | 16 from telemetry import benchmark |
| 17 from telemetry import decorators |
| 17 from telemetry.core import discover | 18 from telemetry.core import discover |
| 18 from telemetry.util import command_line | 19 from telemetry.util import command_line |
| 19 from telemetry.util import matching | 20 from telemetry.util import matching |
| 20 | 21 |
| 21 | 22 |
| 22 CHROMIUM_CONFIG_FILENAME = 'tools/run-perf-test.cfg' | 23 CHROMIUM_CONFIG_FILENAME = 'tools/run-perf-test.cfg' |
| 23 BLINK_CONFIG_FILENAME = 'Tools/run-perf-test.cfg' | 24 BLINK_CONFIG_FILENAME = 'Tools/run-perf-test.cfg' |
| 24 SUCCESS, NO_CHANGES, ERROR = range(3) | 25 SUCCESS, NO_CHANGES, ERROR = range(3) |
| 25 # Unsupported Perf bisect bots. | 26 # Unsupported Perf bisect bots. |
| 26 EXCLUDED_BOTS = { | 27 EXCLUDED_BOTS = { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 It should never be the case that the benchmark will be enabled on the test | 223 It should never be the case that the benchmark will be enabled on the test |
| 223 platform but this method returns True. | 224 platform but this method returns True. |
| 224 | 225 |
| 225 Returns: | 226 Returns: |
| 226 A tuple (is_benchmark_disabled, reason) whereas |is_benchmark_disabled| is | 227 A tuple (is_benchmark_disabled, reason) whereas |is_benchmark_disabled| is |
| 227 a boolean that tells whether we are sure that the benchmark will be | 228 a boolean that tells whether we are sure that the benchmark will be |
| 228 disabled, and |reason| is a string that shows the reason why we think the | 229 disabled, and |reason| is a string that shows the reason why we think the |
| 229 benchmark is disabled for sure. | 230 benchmark is disabled for sure. |
| 230 """ | 231 """ |
| 231 benchmark_name = benchmark_class.Name() | 232 benchmark_name = benchmark_class.Name() |
| 232 benchmark_disabled_strings = set() | 233 benchmark_disabled_strings = decorators.GetDisabledAttributes( |
| 233 if hasattr(benchmark_class, '_disabled_strings'): | 234 benchmark_class) |
| 234 # pylint: disable=protected-access | |
| 235 benchmark_disabled_strings = benchmark_class._disabled_strings | |
| 236 # pylint: enable=protected-access | |
| 237 if 'all' in benchmark_disabled_strings: | 235 if 'all' in benchmark_disabled_strings: |
| 238 return True, 'Benchmark %s is disabled on all platform.' % benchmark_name | 236 return True, 'Benchmark %s is disabled on all platform.' % benchmark_name |
| 239 if trybot_name == 'all': | 237 if trybot_name == 'all': |
| 240 return False, '' | 238 return False, '' |
| 241 trybot_platform = _GetBotPlatformFromTrybotName(trybot_name) | 239 trybot_platform = _GetBotPlatformFromTrybotName(trybot_name) |
| 242 if trybot_platform in benchmark_disabled_strings: | 240 if trybot_platform in benchmark_disabled_strings: |
| 243 return True, ( | 241 return True, ( |
| 244 "Benchmark %s is disabled on %s, and trybot's platform is %s." % | 242 "Benchmark %s is disabled on %s, and trybot's platform is %s." % |
| 245 (benchmark_name, ', '.join(benchmark_disabled_strings), | 243 (benchmark_name, ', '.join(benchmark_disabled_strings), |
| 246 trybot_platform)) | 244 trybot_platform)) |
| 247 benchmark_enabled_strings = None | 245 benchmark_enabled_strings = decorators.GetEnabledAttributes(benchmark_class) |
| 248 if hasattr(benchmark_class, '_enabled_strings'): | |
| 249 # pylint: disable=protected-access | |
| 250 benchmark_enabled_strings = benchmark_class._enabled_strings | |
| 251 # pylint: enable=protected-access | |
| 252 if (benchmark_enabled_strings and | 246 if (benchmark_enabled_strings and |
| 253 trybot_platform not in benchmark_enabled_strings and | 247 trybot_platform not in benchmark_enabled_strings and |
| 254 'all' not in benchmark_enabled_strings): | 248 'all' not in benchmark_enabled_strings): |
| 255 return True, ( | 249 return True, ( |
| 256 "Benchmark %s is only enabled on %s, and trybot's platform is %s." % | 250 "Benchmark %s is only enabled on %s, and trybot's platform is %s." % |
| 257 (benchmark_name, ', '.join(benchmark_enabled_strings), | 251 (benchmark_name, ', '.join(benchmark_enabled_strings), |
| 258 trybot_platform)) | 252 trybot_platform)) |
| 259 if benchmark_class.ShouldDisable != benchmark.Benchmark.ShouldDisable: | 253 if benchmark_class.ShouldDisable != benchmark.Benchmark.ShouldDisable: |
| 260 logging.warning( | 254 logging.warning( |
| 261 'Benchmark %s has ShouldDisable() method defined. If your trybot run ' | 255 'Benchmark %s has ShouldDisable() method defined. If your trybot run ' |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 return ERROR # pylint: disable=lost-exception | 497 return ERROR # pylint: disable=lost-exception |
| 504 logging.info('Checked out original branch: %s', original_branchname) | 498 logging.info('Checked out original branch: %s', original_branchname) |
| 505 returncode, out, err = _RunProcess( | 499 returncode, out, err = _RunProcess( |
| 506 [_GIT_CMD, 'branch', '-D', 'telemetry-tryjob']) | 500 [_GIT_CMD, 'branch', '-D', 'telemetry-tryjob']) |
| 507 if returncode: | 501 if returncode: |
| 508 logging.error('Could not delete telemetry-tryjob branch. ' | 502 logging.error('Could not delete telemetry-tryjob branch. ' |
| 509 'Please delete it manually: %s', err) | 503 'Please delete it manually: %s', err) |
| 510 return ERROR # pylint: disable=lost-exception | 504 return ERROR # pylint: disable=lost-exception |
| 511 logging.info('Deleted temp branch: telemetry-tryjob') | 505 logging.info('Deleted temp branch: telemetry-tryjob') |
| 512 return SUCCESS | 506 return SUCCESS |
| OLD | NEW |