Chromium Code Reviews| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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=W0212 |
| 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 = list(set(getattr(method, attribute, []) + | 140 merged_attributes = getattr(method, attribute, set()).union( |
| 141 getattr(benchmark, attribute, []))) | 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 # Handle the case where the benchmark is Enabled/Disabled everywhere. | 145 # Handle the case where the benchmark is Enabled/Disabled everywhere. |
| 146 if (getattr(method, attribute, None) == [] or | 146 if (getattr(method, attribute, None) or |
|
aiolos (Not reviewing)
2015/11/06 18:37:39
Shouldn't this be
if (not getattr(...) or
no
nednguyen
2015/11/06 18:47:24
Done. Good catch
| |
| 147 getattr(benchmark, attribute, None) == []): | 147 getattr(benchmark, attribute, None)): |
| 148 setattr(method, attribute, []) | 148 setattr(method, attribute, set()) |
| 149 | 149 |
| 150 # Disable some tests on android platform only. | 150 # Disable some tests on android platform only. |
| 151 if sys.modules[benchmark.__module__] in _ANDROID_BLACK_LIST_MODULES: | 151 if sys.modules[benchmark.__module__] in _ANDROID_BLACK_LIST_MODULES: |
| 152 method._disabled_strings.append('android') | 152 method._disabled_strings.add('android') |
| 153 | 153 |
| 154 # TODO(bashi): Remove once crrev.com/1266833004 is landed. | 154 # TODO(bashi): Remove once crrev.com/1266833004 is landed. |
| 155 if benchmark.Name() == 'memory.blink_memory_mobile': | 155 if benchmark.Name() == 'memory.blink_memory_mobile': |
| 156 method._disabled_strings.append('android') | 156 method._disabled_strings.add('android') |
| 157 | 157 |
| 158 setattr(BenchmarkSmokeTest, benchmark.Name(), method) | 158 setattr(BenchmarkSmokeTest, benchmark.Name(), method) |
| 159 | 159 |
| 160 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 160 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
| 161 | 161 |
| 162 return suite | 162 return suite |
| OLD | NEW |