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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 method = SmokeTestGenerator(benchmark) | 100 method = SmokeTestGenerator(benchmark) |
101 | 101 |
102 # Make sure any decorators are propagated from the original declaration. | 102 # Make sure any decorators are propagated from the original declaration. |
103 # (access to protected members) pylint: disable=W0212 | 103 # (access to protected members) pylint: disable=W0212 |
104 # TODO(dpranke): Since we only pick the first test from every class | 104 # TODO(dpranke): Since we only pick the first test from every class |
105 # (above), if that test is disabled, we'll end up not running *any* | 105 # (above), if that test is disabled, we'll end up not running *any* |
106 # test from the class. We should probably discover all of the tests | 106 # test from the class. We should probably discover all of the tests |
107 # in a class, and then throw the ones we don't need away instead. | 107 # in a class, and then throw the ones we don't need away instead. |
108 if hasattr(benchmark, '_enabled_strings'): | 108 if hasattr(benchmark, '_enabled_strings'): |
109 if hasattr(method, '_enabled_strings'): | 109 if (hasattr(method, '_enabled_strings') and |
| 110 method._enabled_strings and benchmark._enabled_strings): |
110 method._enabled_strings += benchmark._enabled_strings | 111 method._enabled_strings += benchmark._enabled_strings |
111 else: | 112 elif not hasattr(method, '_enabled_strings') or method._enabled_strings: |
112 method._enabled_strings = benchmark._enabled_strings | 113 method._enabled_strings = benchmark._enabled_strings |
113 if hasattr(benchmark, '_disabled_strings'): | 114 if hasattr(benchmark, '_disabled_strings'): |
114 if hasattr(method, '_disabled_strings'): | 115 if (hasattr(method, '_disabled_strings') and |
| 116 method._disabled_strings and benchmark._disabled_strings): |
115 method._disabled_strings += benchmark._disabled_strings | 117 method._disabled_strings += benchmark._disabled_strings |
116 else: | 118 elif not hasattr(method, '_disabled_strings') or method._disabled_strings: |
117 method._disabled_strings = benchmark._disabled_strings | 119 method._disabled_strings = benchmark._disabled_strings |
118 setattr(BenchmarkSmokeTest, benchmark.Name(), method) | 120 setattr(BenchmarkSmokeTest, benchmark.Name(), method) |
119 | 121 |
120 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 122 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
121 | 123 |
122 return suite | 124 return suite |
OLD | NEW |