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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 def BenchmarkSmokeTest(self): | 46 def BenchmarkSmokeTest(self): |
47 # Only measure a single page so that this test cycles reasonably quickly. | 47 # Only measure a single page so that this test cycles reasonably quickly. |
48 benchmark.options['pageset_repeat'] = 1 | 48 benchmark.options['pageset_repeat'] = 1 |
49 benchmark.options['page_repeat'] = 1 | 49 benchmark.options['page_repeat'] = 1 |
50 | 50 |
51 class SinglePageBenchmark(benchmark): # pylint: disable=no-init | 51 class SinglePageBenchmark(benchmark): # pylint: disable=no-init |
52 | 52 |
53 def CreateStorySet(self, options): | 53 def CreateStorySet(self, options): |
54 # pylint: disable=super-on-old-class | 54 # pylint: disable=super-on-old-class |
55 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) | 55 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) |
56 for story in story_set.stories: | 56 # Only smoke test the first story since smoke testing everything takes |
57 story_set.stories = [story] | 57 # too long. |
58 break | 58 for s in story_set.stories[1:]: |
| 59 story_set.RemoveStory(s) |
59 return story_set | 60 return story_set |
60 | 61 |
61 # Set the benchmark's default arguments. | 62 # Set the benchmark's default arguments. |
62 options = options_for_unittests.GetCopy() | 63 options = options_for_unittests.GetCopy() |
63 options.output_formats = ['none'] | 64 options.output_formats = ['none'] |
64 parser = options.CreateParser() | 65 parser = options.CreateParser() |
65 | 66 |
66 benchmark.AddCommandLineArgs(parser) | 67 benchmark.AddCommandLineArgs(parser) |
67 benchmark_module.AddCommandLineArgs(parser) | 68 benchmark_module.AddCommandLineArgs(parser) |
68 benchmark.SetArgumentDefaults(parser) | 69 benchmark.SetArgumentDefaults(parser) |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 MergeDecorators(method, disabled_method_attr, benchmark, | 152 MergeDecorators(method, disabled_method_attr, benchmark, |
152 disabled_benchmark_attr) | 153 disabled_benchmark_attr) |
153 MergeDecorators(method, enabled_method_attr, benchmark, | 154 MergeDecorators(method, enabled_method_attr, benchmark, |
154 enabled_benchmark_attr) | 155 enabled_benchmark_attr) |
155 | 156 |
156 setattr(BenchmarkSmokeTest, benchmark.Name(), method) | 157 setattr(BenchmarkSmokeTest, benchmark.Name(), method) |
157 | 158 |
158 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 159 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
159 | 160 |
160 return suite | 161 return suite |
OLD | NEW |