Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: tools/telemetry/telemetry/page/page_runner.py

Issue 292743020: [Telemetry] Reduce misleading spam in unittest output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 collections 5 import collections
6 import copy 6 import copy
7 import logging 7 import logging
8 import optparse 8 import optparse
9 import os 9 import os
10 import random 10 import random
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 if expectation == 'skip': 497 if expectation == 'skip':
498 logging.debug('Skipping test: Skip expectation for %s', page.url) 498 logging.debug('Skipping test: Skip expectation for %s', page.url)
499 results.AddSkip(page, 'Skipped by test expectations') 499 results.AddSkip(page, 'Skipped by test expectations')
500 return 500 return
501 501
502 logging.info('Running %s', page.url) 502 logging.info('Running %s', page.url)
503 503
504 page_state = PageState(page, test.TabForPage(page, state.browser)) 504 page_state = PageState(page, test.TabForPage(page, state.browser))
505 505
506 def ProcessError(): 506 def ProcessError():
507 logging.error('%s:', page.url)
508 exception_formatter.PrintFormattedException()
509 if expectation == 'fail': 507 if expectation == 'fail':
510 logging.info('Error was expected\n') 508 msg = 'Expected exception while running %s' % page.url
511 results.AddSuccess(page) 509 results.AddSuccess(page)
512 else: 510 else:
511 msg = 'Exception while running %s' % page.url
513 results.AddError(page, sys.exc_info()) 512 results.AddError(page, sys.exc_info())
513 exception_formatter.PrintFormattedException(msg=msg)
514 514
515 try: 515 try:
516 page_state.PreparePage(test) 516 page_state.PreparePage(test)
517 if state.repeat_state.ShouldNavigate( 517 if state.repeat_state.ShouldNavigate(
518 finder_options.skip_navigate_on_repeat): 518 finder_options.skip_navigate_on_repeat):
519 page_state.ImplicitPageNavigation(test) 519 page_state.ImplicitPageNavigation(test)
520 test.RunPage(page, page_state.tab, results) 520 test.RunPage(page, page_state.tab, results)
521 util.CloseConnections(page_state.tab) 521 util.CloseConnections(page_state.tab)
522 except page_test.TestNotSupportedOnPlatformFailure: 522 except page_test.TestNotSupportedOnPlatformFailure:
523 raise 523 raise
524 except page_test.Failure: 524 except page_test.Failure:
525 if expectation == 'fail': 525 if expectation == 'fail':
526 logging.info('%s:', page.url) 526 exception_formatter.PrintFormattedException(
527 exception_formatter.PrintFormattedException() 527 msg='Expected failure while running %s' % page.url)
528 logging.info('Failure was expected\n')
529 results.AddSuccess(page) 528 results.AddSuccess(page)
530 else: 529 else:
531 logging.warning('%s:', page.url) 530 exception_formatter.PrintFormattedException(
532 exception_formatter.PrintFormattedException() 531 msg='Failure while running %s' % page.url)
533 results.AddFailure(page, sys.exc_info()) 532 results.AddFailure(page, sys.exc_info())
534 except (util.TimeoutException, exceptions.LoginException, 533 except (util.TimeoutException, exceptions.LoginException,
535 exceptions.ProfilingException): 534 exceptions.ProfilingException):
536 ProcessError() 535 ProcessError()
537 except (exceptions.TabCrashException, exceptions.BrowserGoneException): 536 except (exceptions.TabCrashException, exceptions.BrowserGoneException):
538 ProcessError() 537 ProcessError()
539 # Run() catches these exceptions to relaunch the tab/browser, so re-raise. 538 # Run() catches these exceptions to relaunch the tab/browser, so re-raise.
540 raise 539 raise
541 except page_action.PageActionNotSupported as e: 540 except page_action.PageActionNotSupported as e:
542 results.AddSkip(page, 'Unsupported page action: %s' % e) 541 results.AddSkip(page, 'Unsupported page action: %s' % e)
543 except Exception: 542 except Exception:
544 logging.warning('While running %s', page.url) 543 exception_formatter.PrintFormattedException(
545 exception_formatter.PrintFormattedException() 544 msg='Unhandled exception while running %s' % page.url)
546 results.AddFailure(page, sys.exc_info()) 545 results.AddFailure(page, sys.exc_info())
547 else: 546 else:
548 if expectation == 'fail': 547 if expectation == 'fail':
549 logging.warning('%s was expected to fail, but passed.\n', page.url) 548 logging.warning('%s was expected to fail, but passed.\n', page.url)
550 results.AddSuccess(page) 549 results.AddSuccess(page)
551 finally: 550 finally:
552 page_state.CleanUpPage(test) 551 page_state.CleanUpPage(test)
553 552
554 553
555 def _WaitForThermalThrottlingIfNeeded(platform): 554 def _WaitForThermalThrottlingIfNeeded(platform):
(...skipping 11 matching lines...) Expand all
567 logging.warning('Device is thermally throttled before running ' 566 logging.warning('Device is thermally throttled before running '
568 'performance tests, results will vary.') 567 'performance tests, results will vary.')
569 568
570 569
571 def _CheckThermalThrottling(platform): 570 def _CheckThermalThrottling(platform):
572 if not platform.CanMonitorThermalThrottling(): 571 if not platform.CanMonitorThermalThrottling():
573 return 572 return
574 if platform.HasBeenThermallyThrottled(): 573 if platform.HasBeenThermallyThrottled():
575 logging.warning('Device has been thermally throttled during ' 574 logging.warning('Device has been thermally throttled during '
576 'performance tests, results will vary.') 575 'performance tests, results will vary.')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698