Commit df897187 authored by chrishenry@google.com's avatar chrishenry@google.com

This patch does it adding a flag suppress_gtest_report.

This will fix log parsing error on bot.

BUG=397746

Review URL: https://codereview.chromium.org/440243002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287709 0039d316-1c4b-4281-b951-d872f2087c98
parent 90da7b6f
...@@ -40,6 +40,7 @@ def SmokeTestGenerator(benchmark): ...@@ -40,6 +40,7 @@ def SmokeTestGenerator(benchmark):
# Set the benchmark's default arguments. # Set the benchmark's default arguments.
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
parser = options.CreateParser() parser = options.CreateParser()
benchmark.AddCommandLineArgs(parser) benchmark.AddCommandLineArgs(parser)
......
...@@ -66,6 +66,7 @@ class PageMeasurementUnitTestBase(unittest.TestCase): ...@@ -66,6 +66,7 @@ class PageMeasurementUnitTestBase(unittest.TestCase):
measurement.CustomizeBrowserOptions(options.browser_options) measurement.CustomizeBrowserOptions(options.browser_options)
options.output_file = None options.output_file = None
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
options.output_trace_tag = None options.output_trace_tag = None
page_runner.ProcessCommandLineArgs(temp_parser, options) page_runner.ProcessCommandLineArgs(temp_parser, options)
measurement.ProcessCommandLineArgs(temp_parser, options) measurement.ProcessCommandLineArgs(temp_parser, options)
......
...@@ -83,6 +83,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -83,6 +83,7 @@ class PageRunnerTests(unittest.TestCase):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(Test(), ps, expectations, options, results) page_runner.Run(Test(), ps, expectations, options, results)
...@@ -112,6 +113,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -112,6 +113,7 @@ class PageRunnerTests(unittest.TestCase):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
test = Test() test = Test()
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
...@@ -133,6 +135,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -133,6 +135,7 @@ class PageRunnerTests(unittest.TestCase):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(Test(), ps, expectations, options, results) page_runner.Run(Test(), ps, expectations, options, results)
...@@ -158,6 +161,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -158,6 +161,7 @@ class PageRunnerTests(unittest.TestCase):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'csv' options.output_format = 'csv'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
...@@ -188,6 +192,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -188,6 +192,7 @@ class PageRunnerTests(unittest.TestCase):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
options.reset_results = None options.reset_results = None
options.upload_results = None options.upload_results = None
options.results_label = None options.results_label = None
...@@ -220,6 +225,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -220,6 +225,7 @@ class PageRunnerTests(unittest.TestCase):
self.assertEquals(2, len(results.all_page_specific_values)) self.assertEquals(2, len(results.all_page_specific_values))
options.output_format = 'html' options.output_format = 'html'
options.suppress_gtest_report = True
options.page_repeat = 1 options.page_repeat = 1
options.pageset_repeat = 1 options.pageset_repeat = 1
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
...@@ -250,6 +256,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -250,6 +256,7 @@ class PageRunnerTests(unittest.TestCase):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'buildbot' options.output_format = 'buildbot'
options.output_file = output_file options.output_file = output_file
options.suppress_gtest_report = True
options.reset_results = None options.reset_results = None
options.upload_results = None options.upload_results = None
options.results_label = None options.results_label = None
...@@ -318,6 +325,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -318,6 +325,7 @@ class PageRunnerTests(unittest.TestCase):
test = TestThatInstallsCredentialsBackend(credentials_backend) test = TestThatInstallsCredentialsBackend(credentials_backend)
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(test, ps, expectations, options, results) page_runner.Run(test, ps, expectations, options, results)
...@@ -348,6 +356,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -348,6 +356,7 @@ class PageRunnerTests(unittest.TestCase):
test = TestUserAgent() test = TestUserAgent()
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(test, ps, expectations, options, results) page_runner.Run(test, ps, expectations, options, results)
...@@ -378,6 +387,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -378,6 +387,7 @@ class PageRunnerTests(unittest.TestCase):
test = TestOneTab() test = TestOneTab()
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(test, ps, expectations, options, results) page_runner.Run(test, ps, expectations, options, results)
...@@ -411,6 +421,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -411,6 +421,7 @@ class PageRunnerTests(unittest.TestCase):
test = TestBeforeLaunch() test = TestBeforeLaunch()
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(test, ps, expectations, options, results) page_runner.Run(test, ps, expectations, options, results)
...@@ -439,6 +450,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -439,6 +450,7 @@ class PageRunnerTests(unittest.TestCase):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.page_repeat = 2 options.page_repeat = 2
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
if not browser_finder.FindBrowser(options): if not browser_finder.FindBrowser(options):
return return
test = Measurement() test = Measurement()
...@@ -471,6 +483,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -471,6 +483,7 @@ class PageRunnerTests(unittest.TestCase):
test = Test() test = Test()
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(test, ps, expectations, options, results) page_runner.Run(test, ps, expectations, options, results)
...@@ -508,6 +521,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -508,6 +521,7 @@ class PageRunnerTests(unittest.TestCase):
test = Test() test = Test()
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(test, ps, expectations, options, results) page_runner.Run(test, ps, expectations, options, results)
...@@ -550,6 +564,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -550,6 +564,7 @@ class PageRunnerTests(unittest.TestCase):
def testUseLiveSitesFlagSet(self): def testUseLiveSitesFlagSet(self):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
options.use_live_sites = True options.use_live_sites = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
self.TestUseLiveSitesFlag(options, expect_from_archive=False) self.TestUseLiveSitesFlag(options, expect_from_archive=False)
...@@ -557,6 +572,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -557,6 +572,7 @@ class PageRunnerTests(unittest.TestCase):
def testUseLiveSitesFlagUnset(self): def testUseLiveSitesFlagUnset(self):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
self.TestUseLiveSitesFlag(options, expect_from_archive=True) self.TestUseLiveSitesFlag(options, expect_from_archive=True)
...@@ -594,6 +610,7 @@ class PageRunnerTests(unittest.TestCase): ...@@ -594,6 +610,7 @@ class PageRunnerTests(unittest.TestCase):
options = options_for_unittests.GetCopy() options = options_for_unittests.GetCopy()
options.output_format = 'none' options.output_format = 'none'
options.suppress_gtest_report = True
SetUpPageRunnerArguments(options) SetUpPageRunnerArguments(options)
results = results_options.CreateResults(EmptyMetadataForTest(), options) results = results_options.CreateResults(EmptyMetadataForTest(), options)
page_runner.Run(Test(max_failures=2), ps, expectations, options, results) page_runner.Run(Test(max_failures=2), ps, expectations, options, results)
......
...@@ -13,7 +13,8 @@ class GTestProgressReporter(progress_reporter.ProgressReporter): ...@@ -13,7 +13,8 @@ class GTestProgressReporter(progress_reporter.ProgressReporter):
"""A progress reporter that outputs the progress report in gtest style.""" """A progress reporter that outputs the progress report in gtest style."""
def __init__(self, output_stream, output_skipped_tests_summary=False): def __init__(self, output_stream, output_skipped_tests_summary=False):
super(GTestProgressReporter, self).__init__(output_stream) super(GTestProgressReporter, self).__init__()
self._output_stream = output_stream
self._timestamp = None self._timestamp = None
self._output_skipped_tests_summary = output_skipped_tests_summary self._output_skipped_tests_summary = output_skipped_tests_summary
...@@ -24,11 +25,11 @@ class GTestProgressReporter(progress_reporter.ProgressReporter): ...@@ -24,11 +25,11 @@ class GTestProgressReporter(progress_reporter.ProgressReporter):
def DidAddValue(self, value): def DidAddValue(self, value):
super(GTestProgressReporter, self).DidAddValue(value) super(GTestProgressReporter, self).DidAddValue(value)
if isinstance(value, failure.FailureValue): if isinstance(value, failure.FailureValue):
print >> self.output_stream, failure.GetStringFromExcInfo( print >> self._output_stream, failure.GetStringFromExcInfo(
value.exc_info) value.exc_info)
self.output_stream.flush() self._output_stream.flush()
elif isinstance(value, skip.SkipValue): elif isinstance(value, skip.SkipValue):
print >> self.output_stream, '===== SKIPPING TEST %s: %s =====' % ( print >> self._output_stream, '===== SKIPPING TEST %s: %s =====' % (
value.page.display_name, value.reason) value.page.display_name, value.reason)
# TODO(chrishenry): Consider outputting metric values as well. For # TODO(chrishenry): Consider outputting metric values as well. For
# e.g., it can replace BuildbotOutputFormatter in # e.g., it can replace BuildbotOutputFormatter in
...@@ -37,31 +38,31 @@ class GTestProgressReporter(progress_reporter.ProgressReporter): ...@@ -37,31 +38,31 @@ class GTestProgressReporter(progress_reporter.ProgressReporter):
def WillRunPage(self, page_test_results): def WillRunPage(self, page_test_results):
super(GTestProgressReporter, self).WillRunPage(page_test_results) super(GTestProgressReporter, self).WillRunPage(page_test_results)
print >> self.output_stream, '[ RUN ]', ( print >> self._output_stream, '[ RUN ]', (
page_test_results.current_page.display_name) page_test_results.current_page.display_name)
self.output_stream.flush() self._output_stream.flush()
self._timestamp = time.time() self._timestamp = time.time()
def DidRunPage(self, page_test_results): def DidRunPage(self, page_test_results):
super(GTestProgressReporter, self).DidRunPage(page_test_results) super(GTestProgressReporter, self).DidRunPage(page_test_results)
page = page_test_results.current_page page = page_test_results.current_page
if page_test_results.current_page_run.failed: if page_test_results.current_page_run.failed:
print >> self.output_stream, '[ FAILED ]', page.display_name, ( print >> self._output_stream, '[ FAILED ]', page.display_name, (
'(%0.f ms)' % self._GetMs()) '(%0.f ms)' % self._GetMs())
else: else:
print >> self.output_stream, '[ OK ]', page.display_name, ( print >> self._output_stream, '[ OK ]', page.display_name, (
'(%0.f ms)' % self._GetMs()) '(%0.f ms)' % self._GetMs())
self.output_stream.flush() self._output_stream.flush()
def WillAttemptPageRun(self, page_test_results, attempt_count, max_attempts): def WillAttemptPageRun(self, page_test_results, attempt_count, max_attempts):
super(GTestProgressReporter, self).WillAttemptPageRun( super(GTestProgressReporter, self).WillAttemptPageRun(
page_test_results, attempt_count, max_attempts) page_test_results, attempt_count, max_attempts)
# A failed attempt will have at least 1 value. # A failed attempt will have at least 1 value.
if attempt_count != 1: if attempt_count != 1:
print >> self.output_stream, ( print >> self._output_stream, (
'===== RETRYING PAGE RUN (attempt %s out of %s allowed) =====' % ( '===== RETRYING PAGE RUN (attempt %s out of %s allowed) =====' % (
attempt_count, max_attempts)) attempt_count, max_attempts))
print >> self.output_stream, ( print >> self._output_stream, (
'Page run attempt failed and will be retried. ' 'Page run attempt failed and will be retried. '
'Discarding previous results.') 'Discarding previous results.')
...@@ -76,24 +77,24 @@ class GTestProgressReporter(progress_reporter.ProgressReporter): ...@@ -76,24 +77,24 @@ class GTestProgressReporter(progress_reporter.ProgressReporter):
successful_runs.append(run) successful_runs.append(run)
unit = 'test' if len(successful_runs) == 1 else 'tests' unit = 'test' if len(successful_runs) == 1 else 'tests'
print >> self.output_stream, '[ PASSED ]', ( print >> self._output_stream, '[ PASSED ]', (
'%d %s.' % (len(successful_runs), unit)) '%d %s.' % (len(successful_runs), unit))
if len(failed_runs) > 0: if len(failed_runs) > 0:
unit = 'test' if len(failed_runs) == 1 else 'tests' unit = 'test' if len(failed_runs) == 1 else 'tests'
print >> self.output_stream, '[ FAILED ]', ( print >> self._output_stream, '[ FAILED ]', (
'%d %s, listed below:' % (len(page_test_results.failures), unit)) '%d %s, listed below:' % (len(page_test_results.failures), unit))
for failed_run in failed_runs: for failed_run in failed_runs:
print >> self.output_stream, '[ FAILED ] ', ( print >> self._output_stream, '[ FAILED ] ', (
failed_run.page.display_name) failed_run.page.display_name)
print >> self.output_stream print >> self._output_stream
count = len(failed_runs) count = len(failed_runs)
unit = 'TEST' if count == 1 else 'TESTS' unit = 'TEST' if count == 1 else 'TESTS'
print >> self.output_stream, '%d FAILED %s' % (count, unit) print >> self._output_stream, '%d FAILED %s' % (count, unit)
print >> self.output_stream print >> self._output_stream
if self._output_skipped_tests_summary: if self._output_skipped_tests_summary:
if len(page_test_results.skipped_values) > 0: if len(page_test_results.skipped_values) > 0:
print >> self.output_stream, 'Skipped pages:\n%s\n' % ('\n'.join( print >> self._output_stream, 'Skipped pages:\n%s\n' % ('\n'.join(
v.page.display_name for v in page_test_results.skipped_values)) v.page.display_name for v in page_test_results.skipped_values))
self.output_stream.flush() self._output_stream.flush()
...@@ -33,7 +33,7 @@ class PageTestResults(object): ...@@ -33,7 +33,7 @@ class PageTestResults(object):
self._output_stream = output_stream self._output_stream = output_stream
self._progress_reporter = ( self._progress_reporter = (
progress_reporter if progress_reporter is not None progress_reporter if progress_reporter is not None
else progress_reporter_module.ProgressReporter(self._output_stream)) else progress_reporter_module.ProgressReporter())
self._output_formatters = ( self._output_formatters = (
output_formatters if output_formatters is not None else []) output_formatters if output_formatters is not None else [])
self._trace_tag = trace_tag self._trace_tag = trace_tag
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
class ProgressReporter(object): class ProgressReporter(object):
"""A class that reports progress of a benchmark to the output stream. """A class that reports progress of a benchmark.
The reporter produces output whenever a significant event happens The reporter produces output whenever a significant event happens
during the progress of a benchmark, including (but not limited to): during the progress of a benchmark, including (but not limited to):
...@@ -14,9 +14,6 @@ class ProgressReporter(object): ...@@ -14,9 +14,6 @@ class ProgressReporter(object):
The default implementation outputs nothing. The default implementation outputs nothing.
""" """
def __init__(self, output_stream):
self.output_stream = output_stream
def DidAddValue(self, value): def DidAddValue(self, value):
pass pass
......
...@@ -13,6 +13,7 @@ from telemetry.results import gtest_progress_reporter ...@@ -13,6 +13,7 @@ from telemetry.results import gtest_progress_reporter
from telemetry.results import html_output_formatter from telemetry.results import html_output_formatter
from telemetry.results import json_output_formatter from telemetry.results import json_output_formatter
from telemetry.results import page_test_results from telemetry.results import page_test_results
from telemetry.results import progress_reporter
# Allowed output formats. The default is the first item in the list. # Allowed output formats. The default is the first item in the list.
...@@ -40,10 +41,17 @@ def AddResultsOptions(parser): ...@@ -40,10 +41,17 @@ def AddResultsOptions(parser):
group.add_option('--results-label', group.add_option('--results-label',
default=None, default=None,
help='Optional label to use for the results of a run .') help='Optional label to use for the results of a run .')
group.add_option('--suppress_gtest_report',
default=False,
help='Whether to suppress GTest progress report.')
parser.add_option_group(group) parser.add_option_group(group)
def CreateResults(metadata, options): def CreateResults(metadata, options):
"""
Args:
options: Contains the options specified in AddResultsOptions.
"""
# TODO(chrishenry): This logic prevents us from having multiple # TODO(chrishenry): This logic prevents us from having multiple
# OutputFormatters. We should have an output_file per OutputFormatter. # OutputFormatters. We should have an output_file per OutputFormatter.
# Maybe we should have --output-dir instead of --output-file? # Maybe we should have --output-dir instead of --output-file?
...@@ -63,6 +71,7 @@ def CreateResults(metadata, options): ...@@ -63,6 +71,7 @@ def CreateResults(metadata, options):
output_formatters = [] output_formatters = []
output_skipped_tests_summary = True output_skipped_tests_summary = True
reporter = None
if options.output_format == 'none': if options.output_format == 'none':
pass pass
elif options.output_format == 'csv': elif options.output_format == 'csv':
...@@ -97,7 +106,10 @@ def CreateResults(metadata, options): ...@@ -97,7 +106,10 @@ def CreateResults(metadata, options):
% (options.output_format, % (options.output_format,
', '.join(_OUTPUT_FORMAT_CHOICES))) ', '.join(_OUTPUT_FORMAT_CHOICES)))
reporter = gtest_progress_reporter.GTestProgressReporter( if options.suppress_gtest_report:
sys.stdout, output_skipped_tests_summary=output_skipped_tests_summary) reporter = progress_reporter.ProgressReporter()
else:
reporter = gtest_progress_reporter.GTestProgressReporter(
sys.stdout, output_skipped_tests_summary=output_skipped_tests_summary)
return page_test_results.PageTestResults( return page_test_results.PageTestResults(
output_formatters=output_formatters, progress_reporter=reporter) output_formatters=output_formatters, progress_reporter=reporter)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment