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_actions # pylint: disable=W0611 | 10 from telemetry.core import browser_finder |
11 from telemetry import block_page_benchmark_results | 11 from telemetry.core import browser_options |
12 from telemetry import browser_finder | 12 from telemetry.page import all_page_actions # pylint: disable=W0611 |
13 from telemetry import browser_options | 13 from telemetry.page import block_page_benchmark_results |
14 from telemetry import csv_page_benchmark_results | 14 from telemetry.page import csv_page_benchmark_results |
15 from telemetry import discover | 15 from telemetry.page import multi_page_benchmark |
16 from telemetry import multi_page_benchmark | 16 from telemetry.page import page_runner |
17 from telemetry import page_runner | 17 from telemetry.page import page_set |
18 from telemetry import page_set | 18 from telemetry.test import discover |
19 | 19 |
20 def Main(benchmark_dir): | 20 def Main(benchmark_dir): |
21 """Turns a MultiPageBenchmark into a command-line program. | 21 """Turns a MultiPageBenchmark into a command-line program. |
22 | 22 |
23 Args: | 23 Args: |
24 benchmark_dir: Path to directory containing MultiPageBenchmarks. | 24 benchmark_dir: Path to directory containing MultiPageBenchmarks. |
25 """ | 25 """ |
26 benchmarks = discover.Discover(benchmark_dir, '', | 26 benchmarks = discover.Discover(benchmark_dir, |
| 27 os.path.join(benchmark_dir, '..'), |
| 28 '', |
27 multi_page_benchmark.MultiPageBenchmark) | 29 multi_page_benchmark.MultiPageBenchmark) |
28 | 30 |
29 # Naively find the benchmark. If we use the browser options parser, we run | 31 # 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. | 32 # the risk of failing to parse if we use a benchmark-specific parameter. |
31 benchmark_name = None | 33 benchmark_name = None |
32 for arg in sys.argv: | 34 for arg in sys.argv: |
33 if arg in benchmarks: | 35 if arg in benchmarks: |
34 benchmark_name = arg | 36 benchmark_name = arg |
35 | 37 |
36 options = browser_options.BrowserOptions() | 38 options = browser_options.BrowserOptions() |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 results.PrintSummary(options.browser_executable and '_ref' or '') | 100 results.PrintSummary(options.browser_executable and '_ref' or '') |
99 | 101 |
100 if len(results.page_failures): | 102 if len(results.page_failures): |
101 logging.warning('Failed pages: %s', '\n'.join( | 103 logging.warning('Failed pages: %s', '\n'.join( |
102 [failure['page'].url for failure in results.page_failures])) | 104 [failure['page'].url for failure in results.page_failures])) |
103 | 105 |
104 if len(results.skipped_pages): | 106 if len(results.skipped_pages): |
105 logging.warning('Skipped pages: %s', '\n'.join( | 107 logging.warning('Skipped pages: %s', '\n'.join( |
106 [skipped['page'].url for skipped in results.skipped_pages])) | 108 [skipped['page'].url for skipped in results.skipped_pages])) |
107 return min(255, len(results.page_failures)) | 109 return min(255, len(results.page_failures)) |
OLD | NEW |