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