OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 import csv | 5 import csv |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 from telemetry import all_page_interactions # pylint: disable=W0611 | 10 from telemetry import all_page_interactions # pylint: disable=W0611 |
(...skipping 18 matching lines...) Expand all Loading... |
29 # Naively find the benchmark. If we use the browser options parser, we run | 29 # Naively find the benchmark. If we use the browser options parser, we run |
30 # the risk of failing to parse if we use a benchmark-specific parameter. | 30 # the risk of failing to parse if we use a benchmark-specific parameter. |
31 benchmark_name = None | 31 benchmark_name = None |
32 for arg in sys.argv: | 32 for arg in sys.argv: |
33 if arg in benchmarks: | 33 if arg in benchmarks: |
34 benchmark_name = arg | 34 benchmark_name = arg |
35 | 35 |
36 options = browser_options.BrowserOptions() | 36 options = browser_options.BrowserOptions() |
37 parser = options.CreateParser('%prog [options] <benchmark> <page_set>') | 37 parser = options.CreateParser('%prog [options] <benchmark> <page_set>') |
38 | 38 |
| 39 page_runner.PageRunner.AddCommandLineOptions(parser) |
39 parser.add_option('--output-format', | 40 parser.add_option('--output-format', |
40 dest='output_format', | 41 dest='output_format', |
41 default='csv', | 42 default='csv', |
42 help='Output format. Can be "csv" or "block". ' | 43 help='Output format. Can be "csv" or "block". ' |
43 'Defaults to "%default".') | 44 'Defaults to "%default".') |
44 parser.add_option('-o', '--output', | 45 parser.add_option('-o', '--output', |
45 dest='output_file', | 46 dest='output_file', |
46 help='Redirects output to a file. Defaults to stdout.') | 47 help='Redirects output to a file. Defaults to stdout.') |
47 | 48 |
48 benchmark = None | 49 benchmark = None |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 results.PrintSummary(options.browser_executable and '_ref' or '') | 98 results.PrintSummary(options.browser_executable and '_ref' or '') |
98 | 99 |
99 if len(results.page_failures): | 100 if len(results.page_failures): |
100 logging.warning('Failed pages: %s', '\n'.join( | 101 logging.warning('Failed pages: %s', '\n'.join( |
101 [failure['page'].url for failure in results.page_failures])) | 102 [failure['page'].url for failure in results.page_failures])) |
102 | 103 |
103 if len(results.skipped_pages): | 104 if len(results.skipped_pages): |
104 logging.warning('Skipped pages: %s', '\n'.join( | 105 logging.warning('Skipped pages: %s', '\n'.join( |
105 [skipped['page'].url for skipped in results.skipped_pages])) | 106 [skipped['page'].url for skipped in results.skipped_pages])) |
106 return min(255, len(results.page_failures)) | 107 return min(255, len(results.page_failures)) |
OLD | NEW |