| 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 28 matching lines...) Expand all Loading... |
| 39 # 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 |
| 40 # 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 |
| 41 # than is usally intended. Instead, if a particular benchmark is failing, | 41 # than is usally intended. Instead, if a particular benchmark is failing, |
| 42 # disable it in tools/perf/benchmarks/*. | 42 # disable it in tools/perf/benchmarks/*. |
| 43 @benchmark_module.Disabled('chromeos') # crbug.com/351114 | 43 @benchmark_module.Disabled('chromeos') # crbug.com/351114 |
| 44 def BenchmarkSmokeTest(self): | 44 def BenchmarkSmokeTest(self): |
| 45 # 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. |
| 46 benchmark.options['pageset_repeat'] = 1 | 46 benchmark.options['pageset_repeat'] = 1 |
| 47 benchmark.options['page_repeat'] = 1 | 47 benchmark.options['page_repeat'] = 1 |
| 48 | 48 |
| 49 class SinglePageBenchmark(benchmark): # pylint: disable=W0232 | 49 class SinglePageBenchmark(benchmark): # pylint: disable=no-init |
| 50 def CreateStorySet(self, options): | 50 def CreateStorySet(self, options): |
| 51 # pylint: disable=E1002 | 51 # pylint: disable=E1002 |
| 52 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) | 52 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) |
| 53 for story in story_set.stories: | 53 for story in story_set.stories: |
| 54 story.skip_waits = True | 54 story.skip_waits = True |
| 55 story_set.stories = [story] | 55 story_set.stories = [story] |
| 56 break | 56 break |
| 57 return story_set | 57 return story_set |
| 58 | 58 |
| 59 # Set the benchmark's default arguments. | 59 # Set the benchmark's default arguments. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 if hasattr(benchmark, 'generated_profile_archive'): | 121 if hasattr(benchmark, 'generated_profile_archive'): |
| 122 # We'd like to test these, but don't know how yet. | 122 # We'd like to test these, but don't know how yet. |
| 123 continue | 123 continue |
| 124 | 124 |
| 125 class BenchmarkSmokeTest(unittest.TestCase): | 125 class BenchmarkSmokeTest(unittest.TestCase): |
| 126 pass | 126 pass |
| 127 | 127 |
| 128 method = SmokeTestGenerator(benchmark) | 128 method = SmokeTestGenerator(benchmark) |
| 129 | 129 |
| 130 # Make sure any decorators are propagated from the original declaration. | 130 # Make sure any decorators are propagated from the original declaration. |
| 131 # (access to protected members) pylint: disable=W0212 | 131 # (access to protected members) pylint: disable=protected-access |
| 132 # TODO(dpranke): Since we only pick the first test from every class | 132 # TODO(dpranke): Since we only pick the first test from every class |
| 133 # (above), if that test is disabled, we'll end up not running *any* | 133 # (above), if that test is disabled, we'll end up not running *any* |
| 134 # test from the class. We should probably discover all of the tests | 134 # test from the class. We should probably discover all of the tests |
| 135 # in a class, and then throw the ones we don't need away instead. | 135 # in a class, and then throw the ones we don't need away instead. |
| 136 | 136 |
| 137 # Merge decorators. | 137 # Merge decorators. |
| 138 for attribute in ['_enabled_strings', '_disabled_strings']: | 138 for attribute in ['_enabled_strings', '_disabled_strings']: |
| 139 # Do set union of attributes to eliminate duplicates. | 139 # Do set union of attributes to eliminate duplicates. |
| 140 merged_attributes = getattr(method, attribute, set()).union( | 140 merged_attributes = getattr(method, attribute, set()).union( |
| 141 getattr(benchmark, attribute, set())) | 141 getattr(benchmark, attribute, set())) |
| 142 if merged_attributes: | 142 if merged_attributes: |
| 143 setattr(method, attribute, merged_attributes) | 143 setattr(method, attribute, merged_attributes) |
| 144 | 144 |
| 145 # Disable some tests on android platform only. | 145 # Disable some tests on android platform only. |
| 146 if sys.modules[benchmark.__module__] in _ANDROID_BLACK_LIST_MODULES: | 146 if sys.modules[benchmark.__module__] in _ANDROID_BLACK_LIST_MODULES: |
| 147 method._disabled_strings.add('android') | 147 method._disabled_strings.add('android') |
| 148 | 148 |
| 149 # TODO(bashi): Remove once crrev.com/1266833004 is landed. | 149 # TODO(bashi): Remove once crrev.com/1266833004 is landed. |
| 150 if benchmark.Name() == 'memory.blink_memory_mobile': | 150 if benchmark.Name() == 'memory.blink_memory_mobile': |
| 151 method._disabled_strings.add('android') | 151 method._disabled_strings.add('android') |
| 152 | 152 |
| 153 setattr(BenchmarkSmokeTest, benchmark.Name(), method) | 153 setattr(BenchmarkSmokeTest, benchmark.Name(), method) |
| 154 | 154 |
| 155 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 155 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
| 156 | 156 |
| 157 return suite | 157 return suite |
| OLD | NEW |