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

Unified Diff: tools/perf/benchmarks/benchmark_unittest.py

Issue 816353008: [Telemetry] Explicitly define Name() method for all perf benchmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | tools/perf/benchmarks/blink_perf.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/benchmarks/benchmark_unittest.py
diff --git a/tools/perf/benchmarks/benchmark_unittest.py b/tools/perf/benchmarks/benchmark_unittest.py
index f5ffa5a88a6a0d1712b6a214ffd5b4423a92e260..fb4eae8f158e889b464de97d5dcfb02074652797 100644
--- a/tools/perf/benchmarks/benchmark_unittest.py
+++ b/tools/perf/benchmarks/benchmark_unittest.py
@@ -47,6 +47,26 @@ class TestNoBenchmarkNamesDuplication(unittest.TestCase):
'Multiple benchmarks with the same name %s are '
'found: %s' % (n, str(names_to_benchmarks[n])))
+# Test all perf benchmarks explicitly define the Name() method and the name
+# values are the same as the default one.
+# TODO(nednguyen): remove this test after all perf benchmarks define Name() and
+# checked in.
+class TestPerfBenchmarkNames(unittest.TestCase):
dtu 2015/01/15 21:27:23 Do you even want to check in this check? Just runn
+ def runTest(self):
+ all_benchmarks = _GetAllPerfBenchmarks()
+
+ def BenchmarkName(cls): # Copy from Benchmark.Name()'s implementation
+ name = cls.__module__.split('.')[-1]
+ if hasattr(cls, 'tag'):
+ name += '.' + cls.tag
+ if hasattr(cls, 'page_set'):
+ name += '.' + cls.page_set.Name()
+ return name
+
+ for b in all_benchmarks:
+ self.assertNotEquals(b.Name, benchmark_module.Benchmark.Name)
+ self.assertEquals(b.Name(), BenchmarkName(b))
+
def _AddBenchmarkOptionsTests(suite):
# Using |index_by_class_name=True| allows returning multiple benchmarks
@@ -62,6 +82,7 @@ def _AddBenchmarkOptionsTests(suite):
_BenchmarkOptionsTestGenerator(benchmark))
suite.addTest(BenchmarkOptionsTest(benchmark.Name()))
suite.addTest(TestNoBenchmarkNamesDuplication())
+ suite.addTest(TestPerfBenchmarkNames())
def load_tests(_, _2, _3):
« no previous file with comments | « no previous file | tools/perf/benchmarks/blink_perf.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698