Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 logging | 5 import logging |
| 6 import optparse | 6 import optparse |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import time | 9 import time |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 group.add_option('--use-live-sites', | 52 group.add_option('--use-live-sites', |
| 53 dest='use_live_sites', action='store_true', | 53 dest='use_live_sites', action='store_true', |
| 54 help='Run against live sites and ignore the Web Page Replay archives.') | 54 help='Run against live sites and ignore the Web Page Replay archives.') |
| 55 parser.add_option_group(group) | 55 parser.add_option_group(group) |
| 56 | 56 |
| 57 parser.add_option('-d', '--also-run-disabled-tests', | 57 parser.add_option('-d', '--also-run-disabled-tests', |
| 58 dest='run_disabled_tests', | 58 dest='run_disabled_tests', |
| 59 action='store_true', default=False, | 59 action='store_true', default=False, |
| 60 help='Ignore @Disabled and @Enabled restrictions.') | 60 help='Ignore @Disabled and @Enabled restrictions.') |
| 61 | 61 |
| 62 # Environment options | |
| 63 parser.add_option('--temperature', dest='target_temp', default=None, type=int, | |
| 64 help='Temperature to wait for between pages. In tenths of' | |
|
charliea (OOO until 10-5)
2016/12/02 16:03:12
Can we accept and pass around the temperature valu
rnephew (Reviews Here)
2016/12/12 16:58:58
Done.
| |
| 65 ' degree C.') | |
| 66 | |
| 62 def ProcessCommandLineArgs(parser, args): | 67 def ProcessCommandLineArgs(parser, args): |
| 63 story_module.StoryFilter.ProcessCommandLineArgs(parser, args) | 68 story_module.StoryFilter.ProcessCommandLineArgs(parser, args) |
| 64 results_options.ProcessCommandLineArgs(parser, args) | 69 results_options.ProcessCommandLineArgs(parser, args) |
| 65 | 70 |
| 66 # Page set options | 71 # Page set options |
| 67 if args.page_repeat < 1: | 72 if args.page_repeat < 1: |
| 68 parser.error('--page-repeat must be a positive integer.') | 73 parser.error('--page-repeat must be a positive integer.') |
| 69 if args.pageset_repeat < 1: | 74 if args.pageset_repeat < 1: |
| 70 parser.error('--pageset-repeat must be a positive integer.') | 75 parser.error('--pageset-repeat must be a positive integer.') |
| 76 if args.target_temp is not None: | |
| 77 if args.target_temp < 300 or args.target_temp > 400: | |
| 78 parser.error('--temperature needs to be between 300 and 400') | |
| 71 | 79 |
| 72 | 80 |
| 73 def _RunStoryAndProcessErrorIfNeeded(story, results, state, test): | 81 def _RunStoryAndProcessErrorIfNeeded(story, results, state, test): |
| 74 def ProcessError(description=None): | 82 def ProcessError(description=None): |
| 75 state.DumpStateUponFailure(story, results) | 83 state.DumpStateUponFailure(story, results) |
| 76 results.AddValue(failure.FailureValue(story, sys.exc_info(), description)) | 84 results.AddValue(failure.FailureValue(story, sys.exc_info(), description)) |
| 77 try: | 85 try: |
| 78 if isinstance(test, story_test.StoryTest): | 86 if isinstance(test, story_test.StoryTest): |
| 79 test.WillRunStory(state.platform) | 87 test.WillRunStory(state.platform) |
| 80 state.WillRunStory(story) | 88 state.WillRunStory(story) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 if not state: | 226 if not state: |
| 219 # Construct shared state by using a copy of finder_options. Shared | 227 # Construct shared state by using a copy of finder_options. Shared |
| 220 # state may update the finder_options. If we tear down the shared | 228 # state may update the finder_options. If we tear down the shared |
| 221 # state after this story run, we want to construct the shared | 229 # state after this story run, we want to construct the shared |
| 222 # state for the next story from the original finder_options. | 230 # state for the next story from the original finder_options. |
| 223 state = group.shared_state_class( | 231 state = group.shared_state_class( |
| 224 test, finder_options.Copy(), story_set) | 232 test, finder_options.Copy(), story_set) |
| 225 results.WillRunPage( | 233 results.WillRunPage( |
| 226 story, storyset_repeat_counter, story_repeat_counter) | 234 story, storyset_repeat_counter, story_repeat_counter) |
| 227 try: | 235 try: |
| 236 if finder_options.target_temp: | |
| 237 state.platform.WaitForTemperature(finder_options.target_temp) | |
| 228 _WaitForThermalThrottlingIfNeeded(state.platform) | 238 _WaitForThermalThrottlingIfNeeded(state.platform) |
| 229 _RunStoryAndProcessErrorIfNeeded(story, results, state, test) | 239 _RunStoryAndProcessErrorIfNeeded(story, results, state, test) |
| 230 except exceptions.Error: | 240 except exceptions.Error: |
| 231 # Catch all Telemetry errors to give the story a chance to retry. | 241 # Catch all Telemetry errors to give the story a chance to retry. |
| 232 # The retry is enabled by tearing down the state and creating | 242 # The retry is enabled by tearing down the state and creating |
| 233 # a new state instance in the next iteration. | 243 # a new state instance in the next iteration. |
| 234 try: | 244 try: |
| 235 # If TearDownState raises, do not catch the exception. | 245 # If TearDownState raises, do not catch the exception. |
| 236 # (The Error was saved as a failure value.) | 246 # (The Error was saved as a failure value.) |
| 237 state.TearDownState() | 247 state.TearDownState() |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 logging.warning('Device is thermally throttled before running ' | 445 logging.warning('Device is thermally throttled before running ' |
| 436 'performance tests, results will vary.') | 446 'performance tests, results will vary.') |
| 437 | 447 |
| 438 | 448 |
| 439 def _CheckThermalThrottling(platform): | 449 def _CheckThermalThrottling(platform): |
| 440 if not platform.CanMonitorThermalThrottling(): | 450 if not platform.CanMonitorThermalThrottling(): |
| 441 return | 451 return |
| 442 if platform.HasBeenThermallyThrottled(): | 452 if platform.HasBeenThermallyThrottled(): |
| 443 logging.warning('Device has been thermally throttled during ' | 453 logging.warning('Device has been thermally throttled during ' |
| 444 'performance tests, results will vary.') | 454 'performance tests, results will vary.') |
| OLD | NEW |