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

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: better 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 pass 96 pass
97 97
98 method = SmokeTestGenerator(benchmark) 98 method = SmokeTestGenerator(benchmark)
99 99
100 # Make sure any decorators are propagated from the original declaration. 100 # Make sure any decorators are propagated from the original declaration.
101 # (access to protected members) pylint: disable=W0212 101 # (access to protected members) pylint: disable=W0212
102 # TODO(dpranke): Since we only pick the first test from every class 102 # TODO(dpranke): Since we only pick the first test from every class
103 # (above), if that test is disabled, we'll end up not running *any* 103 # (above), if that test is disabled, we'll end up not running *any*
104 # test from the class. We should probably discover all of the tests 104 # test from the class. We should probably discover all of the tests
105 # in a class, and then throw the ones we don't need away instead. 105 # in a class, and then throw the ones we don't need away instead.
106 if hasattr(benchmark, '_enabled_strings'): 106
107 method._enabled_strings = benchmark._enabled_strings 107 # Merge decorators.
108 if hasattr(benchmark, '_disabled_strings'): 108 for attr in ['_enabled_strings', '_disabled_strings']:
dtu 2015/05/05 21:09:08 style nit: don't abbreviate (not in google style g
achuithb 2015/05/05 22:01:10 Done.
109 method._disabled_strings = benchmark._disabled_strings 109 tmp = set()
dtu 2015/05/05 21:09:08 Shorter: merged_attributes = set(getattr(method,
achuithb 2015/05/05 22:01:10 Done.
110 if hasattr(method, attr):
111 tmp.update(getattr(method, attr))
112 if hasattr(benchmark, attr):
113 tmp.update(getattr(benchmark, attr))
114 if tmp:
115 setattr(method, attr, list(tmp))
116
110 setattr(BenchmarkSmokeTest, benchmark.Name(), method) 117 setattr(BenchmarkSmokeTest, benchmark.Name(), method)
111 118
112 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) 119 suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
113 120
114 return suite 121 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