| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 spaceport, # Takes 451 seconds. | 91 spaceport, # Takes 451 seconds. |
| 92 speedometer, # Takes 101 seconds. | 92 speedometer, # Takes 101 seconds. |
| 93 jetstream, # Take 206 seconds. | 93 jetstream, # Take 206 seconds. |
| 94 text_selection, # Always fails on cq bot. | 94 text_selection, # Always fails on cq bot. |
| 95 kraken, # Flaky on Android, crbug.com/626174. | 95 kraken, # Flaky on Android, crbug.com/626174. |
| 96 v8_browsing, # Flaky on Android, crbug.com/628368. | 96 v8_browsing, # Flaky on Android, crbug.com/628368. |
| 97 battor #Flaky on android, crbug.com/618330. | 97 battor #Flaky on android, crbug.com/618330. |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 def MergeDecorators(method, method_attribute, benchmark, benchmark_attribute): |
| 102 # Do set union of attributes to eliminate duplicates. |
| 103 merged_attributes = getattr(method, method_attribute, set()).union( |
| 104 getattr(benchmark, benchmark_attribute, set())) |
| 105 if merged_attributes: |
| 106 setattr(method, method_attribute, merged_attributes) |
| 107 |
| 108 |
| 101 def load_tests(loader, standard_tests, pattern): | 109 def load_tests(loader, standard_tests, pattern): |
| 102 del loader, standard_tests, pattern # unused | 110 del loader, standard_tests, pattern # unused |
| 103 suite = progress_reporter.TestSuite() | 111 suite = progress_reporter.TestSuite() |
| 104 | 112 |
| 105 benchmarks_dir = os.path.dirname(__file__) | 113 benchmarks_dir = os.path.dirname(__file__) |
| 106 top_level_dir = os.path.dirname(benchmarks_dir) | 114 top_level_dir = os.path.dirname(benchmarks_dir) |
| 107 | 115 |
| 108 # Using the default of |index_by_class_name=False| means that if a module | 116 # Using the default of |index_by_class_name=False| means that if a module |
| 109 # has multiple benchmarks, only the last one is returned. | 117 # has multiple benchmarks, only the last one is returned. |
| 110 all_benchmarks = discover.DiscoverClasses( | 118 all_benchmarks = discover.DiscoverClasses( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 140 except AttributeError: | 148 except AttributeError: |
| 141 enabled_benchmark_attr = '_enabled_strings' | 149 enabled_benchmark_attr = '_enabled_strings' |
| 142 enabled_method_attr = '_enabled_strings' | 150 enabled_method_attr = '_enabled_strings' |
| 143 disabled_benchmark_attr = '_disabled_strings' | 151 disabled_benchmark_attr = '_disabled_strings' |
| 144 disabled_method_attr = '_disabled_strings' | 152 disabled_method_attr = '_disabled_strings' |
| 145 else: | 153 else: |
| 146 disabled_benchmark_attr = decorators.DisabledAttributeName(benchmark) | 154 disabled_benchmark_attr = decorators.DisabledAttributeName(benchmark) |
| 147 disabled_method_attr = decorators.DisabledAttributeName(method) | 155 disabled_method_attr = decorators.DisabledAttributeName(method) |
| 148 enabled_benchmark_attr = decorators.EnabledAttributeName(benchmark) | 156 enabled_benchmark_attr = decorators.EnabledAttributeName(benchmark) |
| 149 enabled_method_attr = decorators.EnabledAttributeName(method) | 157 enabled_method_attr = decorators.EnabledAttributeName(method) |
| 150 # Merge decorators. | |
| 151 def MergeDecorators(method_attribute, benchmark_attribute): | |
| 152 # Do set union of attributes to eliminate duplicates. | |
| 153 merged_attributes = getattr(method, method_attribute, set()).union( | |
| 154 getattr(benchmark, benchmark_attribute, set())) | |
| 155 if merged_attributes: | |
| 156 setattr(method, method_attribute, merged_attributes) | |
| 157 | 158 |
| 158 MergeDecorators(disabled_method_attr, disabled_benchmark_attr) | 159 MergeDecorators(method, disabled_method_attr, benchmark, |
| 159 MergeDecorators(enabled_method_attr, enabled_benchmark_attr) | 160 disabled_benchmark_attr) |
| 161 MergeDecorators(method, enabled_method_attr, benchmark, |
| 162 enabled_benchmark_attr) |
| 160 | 163 |
| 161 setattr(BenchmarkSmokeTest, benchmark.Name(), method) | 164 setattr(BenchmarkSmokeTest, benchmark.Name(), method) |
| 162 | 165 |
| 163 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 166 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
| 164 | 167 |
| 165 return suite | 168 return suite |
| OLD | NEW |