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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/benchmarks/benchmark_smoke_unittest.py
diff --git a/tools/perf/benchmarks/benchmark_smoke_unittest.py b/tools/perf/benchmarks/benchmark_smoke_unittest.py
index ce62e3a755ad23bf3f5b28b49fa1c5b7e29bb46d..4630c5b1d2a2cf6e469db0b4f8c33ba3cf00d6fc 100644
--- a/tools/perf/benchmarks/benchmark_smoke_unittest.py
+++ b/tools/perf/benchmarks/benchmark_smoke_unittest.py
@@ -104,10 +104,20 @@ def load_tests(loader, standard_tests, pattern):
# (above), if that test is disabled, we'll end up not running *any*
# test from the class. We should probably discover all of the tests
# in a class, and then throw the ones we don't need away instead.
- if hasattr(benchmark, '_enabled_strings'):
- method._enabled_strings = benchmark._enabled_strings
- if hasattr(benchmark, '_disabled_strings'):
- method._disabled_strings = benchmark._disabled_strings
+
+ # Merge decorators.
+ for attribute in ['_enabled_strings', '_disabled_strings']:
+ # Do set union of attributes to eliminate duplicates.
+ merged_attributes = list(set(getattr(method, attribute, []) +
+ getattr(benchmark, attribute, [])))
+ if merged_attributes:
+ setattr(method, attribute, merged_attributes)
+
+ # Handle the case where the benchmark is Enabled/Disabled everywhere.
+ if (getattr(method, attribute, None) == [] or
+ getattr(benchmark, attribute, None) == []):
+ setattr(method, attribute, [])
+
setattr(BenchmarkSmokeTest, benchmark.Name(), method)
suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
« 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