Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: tools/perf/benchmarks/benchmark_smoke_unittest.py

Issue 1128433007: Merge suite and benchmark decorators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix global Disable Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 pass 97 pass
98 98
99 method = SmokeTestGenerator(benchmark) 99 method = SmokeTestGenerator(benchmark)
100 100
101 # Make sure any decorators are propagated from the original declaration. 101 # Make sure any decorators are propagated from the original declaration.
102 # (access to protected members) pylint: disable=W0212 102 # (access to protected members) pylint: disable=W0212
103 # TODO(dpranke): Since we only pick the first test from every class 103 # TODO(dpranke): Since we only pick the first test from every class
104 # (above), if that test is disabled, we'll end up not running *any* 104 # (above), if that test is disabled, we'll end up not running *any*
105 # test from the class. We should probably discover all of the tests 105 # test from the class. We should probably discover all of the tests
106 # in a class, and then throw the ones we don't need away instead. 106 # in a class, and then throw the ones we don't need away instead.
107 if hasattr(benchmark, '_enabled_strings'): 107
108 method._enabled_strings = benchmark._enabled_strings 108 # Merge decorators.
109 if hasattr(benchmark, '_disabled_strings'): 109 for attribute in ['_enabled_strings', '_disabled_strings']:
110 method._disabled_strings = benchmark._disabled_strings 110 # Do set union of attributes to eliminate duplicates.
111 merged_attributes = list(set(getattr(method, attribute, []) +
112 getattr(benchmark, attribute, [])))
113 if merged_attributes:
114 setattr(method, attribute, merged_attributes)
115
116 # Handle the case where the benchmark is Enabled/Disabled everywhere.
117 if (getattr(method, attribute, None) == [] or
118 getattr(benchmark, attribute, None) == []):
119 setattr(method, attribute, [])
120
111 setattr(BenchmarkSmokeTest, benchmark.Name(), method) 121 setattr(BenchmarkSmokeTest, benchmark.Name(), method)
112 122
113 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) 123 suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
114 124
115 return suite 125 return suite
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698