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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 | 95 |
96 def load_tests(loader, standard_tests, pattern): | 96 def load_tests(loader, standard_tests, pattern): |
97 del loader, standard_tests, pattern # unused | 97 del loader, standard_tests, pattern # unused |
98 suite = progress_reporter.TestSuite() | 98 suite = progress_reporter.TestSuite() |
99 | 99 |
100 benchmarks_dir = os.path.dirname(__file__) | 100 benchmarks_dir = os.path.dirname(__file__) |
101 top_level_dir = os.path.dirname(benchmarks_dir) | 101 top_level_dir = os.path.dirname(benchmarks_dir) |
102 | 102 |
103 # Using the default of |index_by_class_name=False| means that if a module | 103 # Using the default of |one_class_per_module=True| means that if a module |
104 # has multiple benchmarks, only the last one is returned. | 104 # has multiple benchmarks, only the first one is returned. |
105 all_benchmarks = discover.DiscoverClasses( | 105 all_benchmarks = discover.DiscoverClasses( |
106 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, | 106 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, |
107 index_by_class_name=False).values() | 107 one_class_per_module=True) |
108 for benchmark in all_benchmarks: | 108 for benchmark in all_benchmarks: |
109 if sys.modules[benchmark.__module__] in _BLACK_LIST_TEST_MODULES: | 109 if sys.modules[benchmark.__module__] in _BLACK_LIST_TEST_MODULES: |
110 continue | 110 continue |
111 # TODO(tonyg): Smoke doesn't work with session_restore yet. | 111 # TODO(tonyg): Smoke doesn't work with session_restore yet. |
112 if (benchmark.Name().startswith('session_restore') or | 112 if (benchmark.Name().startswith('session_restore') or |
113 benchmark.Name().startswith('skpicture_printer')): | 113 benchmark.Name().startswith('skpicture_printer')): |
114 continue | 114 continue |
115 | 115 |
116 if hasattr(benchmark, 'generated_profile_archive'): | 116 if hasattr(benchmark, 'generated_profile_archive'): |
117 # We'd like to test these, but don't know how yet. | 117 # We'd like to test these, but don't know how yet. |
(...skipping 26 matching lines...) Expand all Loading... |
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.append('android') | 147 method._disabled_strings.append('android') |
148 | 148 |
149 setattr(BenchmarkSmokeTest, benchmark.Name(), method) | 149 setattr(BenchmarkSmokeTest, benchmark.Name(), method) |
150 | 150 |
151 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 151 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
152 | 152 |
153 return suite | 153 return suite |
OLD | NEW |