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 """Run the first page of one benchmark for every module. | 5 """Run the first page of one benchmark for every module. |
6 | 6 |
7 Only benchmarks that have a composable measurement are included. | 7 Only benchmarks that have a composable measurement are included. |
8 Ideally this test would be comprehensive, however, running one page | 8 Ideally this test would be comprehensive, however, running one page |
9 of every benchmark would run impractically long. | 9 of every benchmark would run impractically long. |
10 """ | 10 """ |
(...skipping 14 matching lines...) Expand all Loading... | |
25 from benchmarks import octane | 25 from benchmarks import octane |
26 from benchmarks import kraken | 26 from benchmarks import kraken |
27 from benchmarks import sunspider | 27 from benchmarks import sunspider |
28 from benchmarks import rasterize_and_record_micro | 28 from benchmarks import rasterize_and_record_micro |
29 from benchmarks import repaint | 29 from benchmarks import repaint |
30 from benchmarks import spaceport | 30 from benchmarks import spaceport |
31 from benchmarks import speedometer | 31 from benchmarks import speedometer |
32 from benchmarks import jetstream | 32 from benchmarks import jetstream |
33 | 33 |
34 | 34 |
35 def SmokeTestGenerator(benchmark): | 35 def SmokeTestGenerator(benchmark, num_pages=1): |
36 """Generates a benchmark that includes first N pages from pageset.""" | |
36 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. | 37 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. |
37 # | 38 # |
38 # This smoke test dynamically tests all benchmarks. So disabling it for one | 39 # This smoke test dynamically tests all benchmarks. So disabling it for one |
39 # failing or flaky benchmark would disable a much wider swath of coverage | 40 # failing or flaky benchmark would disable a much wider swath of coverage |
40 # than is usally intended. Instead, if a particular benchmark is failing, | 41 # than is usally intended. Instead, if a particular benchmark is failing, |
41 # disable it in tools/perf/benchmarks/*. | 42 # disable it in tools/perf/benchmarks/*. |
42 @benchmark_module.Disabled('chromeos') # crbug.com/351114 | 43 @benchmark_module.Disabled('chromeos') # crbug.com/351114 |
43 def BenchmarkSmokeTest(self): | 44 def BenchmarkSmokeTest(self): |
44 # Only measure a single page so that this test cycles reasonably quickly. | 45 # Only measure a single page so that this test cycles reasonably quickly. |
45 benchmark.options['pageset_repeat'] = 1 | 46 benchmark.options['pageset_repeat'] = 1 |
46 benchmark.options['page_repeat'] = 1 | 47 benchmark.options['page_repeat'] = 1 |
47 | 48 |
48 class SinglePageBenchmark(benchmark): # pylint: disable=W0232 | 49 class SinglePageBenchmark(benchmark): # pylint: disable=W0232 |
49 def CreatePageSet(self, options): | 50 def CreatePageSet(self, options): |
50 # pylint: disable=E1002 | 51 # pylint: disable=E1002 |
51 ps = super(SinglePageBenchmark, self).CreatePageSet(options) | 52 ps = super(SinglePageBenchmark, self).CreatePageSet(options) |
52 for p in ps.pages: | 53 user_stories = [] |
54 for p in ps.pages[:num_pages]: | |
53 p.skip_waits = True | 55 p.skip_waits = True |
54 ps.user_stories = [p] | 56 user_stories.append(p) |
55 break | 57 ps.user_stories = user_stories |
56 return ps | 58 return ps |
57 | 59 |
58 # Set the benchmark's default arguments. | 60 # Set the benchmark's default arguments. |
59 options = options_for_unittests.GetCopy() | 61 options = options_for_unittests.GetCopy() |
60 options.output_format = 'none' | 62 options.output_format = 'none' |
61 options.suppress_gtest_report = True | 63 options.suppress_gtest_report = True |
62 parser = options.CreateParser() | 64 parser = options.CreateParser() |
63 | 65 |
64 benchmark.AddCommandLineArgs(parser) | 66 benchmark.AddCommandLineArgs(parser) |
65 benchmark_module.AddCommandLineArgs(parser) | 67 benchmark_module.AddCommandLineArgs(parser) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 benchmark.Name().startswith('skpicture_printer')): | 123 benchmark.Name().startswith('skpicture_printer')): |
122 continue | 124 continue |
123 | 125 |
124 if hasattr(benchmark, 'generated_profile_archive'): | 126 if hasattr(benchmark, 'generated_profile_archive'): |
125 # We'd like to test these, but don't know how yet. | 127 # We'd like to test these, but don't know how yet. |
126 continue | 128 continue |
127 | 129 |
128 class BenchmarkSmokeTest(unittest.TestCase): | 130 class BenchmarkSmokeTest(unittest.TestCase): |
129 pass | 131 pass |
130 | 132 |
131 method = SmokeTestGenerator(benchmark) | 133 # It is wrong to give tab_switching only one page to switch. |
134 if 'tab_switching' in benchmark.Name(): | |
135 method = SmokeTestGenerator(benchmark, num_pages=2) | |
nednguyen
2015/06/24 14:53:10
This fix is reasonable. But please check the cycle
| |
136 else: | |
137 method = SmokeTestGenerator(benchmark) | |
132 | 138 |
133 # Make sure any decorators are propagated from the original declaration. | 139 # Make sure any decorators are propagated from the original declaration. |
134 # (access to protected members) pylint: disable=W0212 | 140 # (access to protected members) pylint: disable=W0212 |
135 # TODO(dpranke): Since we only pick the first test from every class | 141 # TODO(dpranke): Since we only pick the first test from every class |
136 # (above), if that test is disabled, we'll end up not running *any* | 142 # (above), if that test is disabled, we'll end up not running *any* |
137 # test from the class. We should probably discover all of the tests | 143 # test from the class. We should probably discover all of the tests |
138 # in a class, and then throw the ones we don't need away instead. | 144 # in a class, and then throw the ones we don't need away instead. |
139 | 145 |
140 # Merge decorators. | 146 # Merge decorators. |
141 for attribute in ['_enabled_strings', '_disabled_strings']: | 147 for attribute in ['_enabled_strings', '_disabled_strings']: |
(...skipping 10 matching lines...) Expand all Loading... | |
152 | 158 |
153 # Disable some tests on android platform only. | 159 # Disable some tests on android platform only. |
154 if sys.modules[benchmark.__module__] in _ANDROID_BLACK_LIST_MODULES: | 160 if sys.modules[benchmark.__module__] in _ANDROID_BLACK_LIST_MODULES: |
155 method._disabled_strings.append('android') | 161 method._disabled_strings.append('android') |
156 | 162 |
157 setattr(BenchmarkSmokeTest, benchmark.Name(), method) | 163 setattr(BenchmarkSmokeTest, benchmark.Name(), method) |
158 | 164 |
159 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 165 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
160 | 166 |
161 return suite | 167 return suite |
OLD | NEW |