| 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 random | 8 import random |
| 9 import sys | 9 import sys |
| 10 import time | 10 import time |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 can continue running the remaining user stories. | 197 can continue running the remaining user stories. |
| 198 """ | 198 """ |
| 199 test.ValidatePageSet(user_story_set) | 199 test.ValidatePageSet(user_story_set) |
| 200 | 200 |
| 201 # Reorder page set based on options. | 201 # Reorder page set based on options. |
| 202 user_stories = _ShuffleAndFilterUserStorySet(user_story_set, finder_options) | 202 user_stories = _ShuffleAndFilterUserStorySet(user_story_set, finder_options) |
| 203 | 203 |
| 204 if (not finder_options.use_live_sites and | 204 if (not finder_options.use_live_sites and |
| 205 finder_options.browser_options.wpr_mode != wpr_modes.WPR_RECORD): | 205 finder_options.browser_options.wpr_mode != wpr_modes.WPR_RECORD): |
| 206 _UpdateUserStoryArchivesIfChanged(user_story_set) | 206 _UpdateUserStoryArchivesIfChanged(user_story_set) |
| 207 if not _CheckArchives( | 207 if not _UpdateAndCheckArchives( |
| 208 user_story_set.archive_data_file, user_story_set.wpr_archive_info, | 208 user_story_set.archive_data_file, user_story_set.wpr_archive_info, |
| 209 user_stories): | 209 user_stories): |
| 210 return | 210 return |
| 211 | 211 |
| 212 for user_story in list(user_stories): | 212 for user_story in list(user_stories): |
| 213 if not test.CanRunForPage(user_story): | 213 if not test.CanRunForPage(user_story): |
| 214 results.WillRunPage(user_story) | 214 results.WillRunPage(user_story) |
| 215 logging.debug('Skipping test: it cannot run for %s', | 215 logging.debug('Skipping test: it cannot run for %s', |
| 216 user_story.display_name) | 216 user_story.display_name) |
| 217 results.AddValue(skip.SkipValue(user_story, 'Test cannot run')) | 217 results.AddValue(skip.SkipValue(user_story, 'Test cannot run')) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 else: | 297 else: |
| 298 raise Exception( | 298 raise Exception( |
| 299 'pageset-shuffle-order-file flag can only be used with page set') | 299 'pageset-shuffle-order-file flag can only be used with page set') |
| 300 user_stories = [u for u in user_story_set[:] | 300 user_stories = [u for u in user_story_set[:] |
| 301 if user_story_filter.UserStoryFilter.IsSelected(u)] | 301 if user_story_filter.UserStoryFilter.IsSelected(u)] |
| 302 if finder_options.pageset_shuffle: | 302 if finder_options.pageset_shuffle: |
| 303 random.shuffle(user_stories) | 303 random.shuffle(user_stories) |
| 304 return user_stories | 304 return user_stories |
| 305 | 305 |
| 306 | 306 |
| 307 def _CheckArchives(archive_data_file, wpr_archive_info, filtered_user_stories): | 307 def _UpdateAndCheckArchives(archive_data_file, wpr_archive_info, |
| 308 filtered_user_stories): |
| 308 """Verifies that all user stories are local or have WPR archives. | 309 """Verifies that all user stories are local or have WPR archives. |
| 309 | 310 |
| 310 Logs warnings and returns False if any are missing. | 311 Logs warnings and returns False if any are missing. |
| 311 """ | 312 """ |
| 312 # Report any problems with the entire user story set. | 313 # Report any problems with the entire user story set. |
| 313 if any(not user_story.is_local for user_story in filtered_user_stories): | 314 if any(not user_story.is_local for user_story in filtered_user_stories): |
| 314 if not archive_data_file: | 315 if not archive_data_file: |
| 315 logging.error('The user story set is missing an "archive_data_file" ' | 316 logging.error('The user story set is missing an "archive_data_file" ' |
| 316 'property.\nTo run from live sites pass the flag ' | 317 'property.\nTo run from live sites pass the flag ' |
| 317 '--use-live-sites.\nTo create an archive file add an ' | 318 '--use-live-sites.\nTo create an archive file add an ' |
| 318 'archive_data_file property to the user story set and then ' | 319 'archive_data_file property to the user story set and then ' |
| 319 'run record_wpr.') | 320 'run record_wpr.') |
| 320 return False | 321 return False |
| 321 if not wpr_archive_info: | 322 if not wpr_archive_info: |
| 322 logging.error('The archive info file is missing.\n' | 323 logging.error('The archive info file is missing.\n' |
| 323 'To fix this, either add svn-internal to your ' | 324 'To fix this, either add svn-internal to your ' |
| 324 '.gclient using http://goto/read-src-internal, ' | 325 '.gclient using http://goto/read-src-internal, ' |
| 325 'or create a new archive using record_wpr.') | 326 'or create a new archive using record_wpr.') |
| 326 return False | 327 return False |
| 328 wpr_archive_info.DownloadArchivesIfNeeded() |
| 327 | 329 |
| 328 # Report any problems with individual user story. | 330 # Report any problems with individual user story. |
| 329 user_stories_missing_archive_path = [] | 331 user_stories_missing_archive_path = [] |
| 330 user_stories_missing_archive_data = [] | 332 user_stories_missing_archive_data = [] |
| 331 for user_story in filtered_user_stories: | 333 for user_story in filtered_user_stories: |
| 332 if not user_story.is_local: | 334 if not user_story.is_local: |
| 333 archive_path = wpr_archive_info.WprFilePathForUserStory(user_story) | 335 archive_path = wpr_archive_info.WprFilePathForUserStory(user_story) |
| 334 if not archive_path: | 336 if not archive_path: |
| 335 user_stories_missing_archive_path.append(user_story) | 337 user_stories_missing_archive_path.append(user_story) |
| 336 elif not os.path.isfile(archive_path): | 338 elif not os.path.isfile(archive_path): |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 logging.warning('Device is thermally throttled before running ' | 381 logging.warning('Device is thermally throttled before running ' |
| 380 'performance tests, results will vary.') | 382 'performance tests, results will vary.') |
| 381 | 383 |
| 382 | 384 |
| 383 def _CheckThermalThrottling(platform): | 385 def _CheckThermalThrottling(platform): |
| 384 if not platform.CanMonitorThermalThrottling(): | 386 if not platform.CanMonitorThermalThrottling(): |
| 385 return | 387 return |
| 386 if platform.HasBeenThermallyThrottled(): | 388 if platform.HasBeenThermallyThrottled(): |
| 387 logging.warning('Device has been thermally throttled during ' | 389 logging.warning('Device has been thermally throttled during ' |
| 388 'performance tests, results will vary.') | 390 'performance tests, results will vary.') |
| OLD | NEW |