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

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

Issue 1244223002: Create classes_util API, change discover to return a list instead of a dict. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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
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 """For all the benchmarks that set options, test that the options are valid.""" 5 """For all the benchmarks that set options, test that the options are valid."""
6 6
7 from collections import defaultdict 7 from collections import defaultdict
8 import os 8 import os
9 import unittest 9 import unittest
10 10
11 from core import perf_benchmark 11 from core import perf_benchmark
12 12
13 from telemetry import benchmark as benchmark_module 13 from telemetry import benchmark as benchmark_module
14 from telemetry.core import discover
15 from telemetry.internal.browser import browser_options 14 from telemetry.internal.browser import browser_options
16 from telemetry.testing import progress_reporter 15 from telemetry.testing import progress_reporter
16 from telemetry.util import classes_util
17 17
18 18
19 def _GetPerfDir(*subdirs): 19 def _GetPerfDir(*subdirs):
20 perf_dir = os.path.dirname(os.path.dirname(__file__)) 20 perf_dir = os.path.dirname(os.path.dirname(__file__))
21 return os.path.join(perf_dir, *subdirs) 21 return os.path.join(perf_dir, *subdirs)
22 22
23 23
24 def _GetAllPerfBenchmarks(): 24 def _GetAllPerfBenchmarks():
25 return discover.DiscoverClasses( 25 return classes_util.DiscoverClasses(
26 _GetPerfDir('benchmarks'), _GetPerfDir(), benchmark_module.Benchmark, 26 _GetPerfDir('benchmarks'), _GetPerfDir(), benchmark_module.Benchmark)
27 index_by_class_name=True).values()
28 27
29 def _BenchmarkOptionsTestGenerator(benchmark): 28 def _BenchmarkOptionsTestGenerator(benchmark):
30 def testBenchmarkOptions(self): # pylint: disable=W0613 29 def testBenchmarkOptions(self): # pylint: disable=W0613
31 """Invalid options will raise benchmark.InvalidOptionsError.""" 30 """Invalid options will raise benchmark.InvalidOptionsError."""
32 options = browser_options.BrowserFinderOptions() 31 options = browser_options.BrowserFinderOptions()
33 parser = options.CreateParser() 32 parser = options.CreateParser()
34 benchmark.AddCommandLineArgs(parser) 33 benchmark.AddCommandLineArgs(parser)
35 benchmark_module.AddCommandLineArgs(parser) 34 benchmark_module.AddCommandLineArgs(parser)
36 benchmark.SetArgumentDefaults(parser) 35 benchmark.SetArgumentDefaults(parser)
37 return testBenchmarkOptions 36 return testBenchmarkOptions
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 suite.addTest(BenchmarkOptionsTest(benchmark.Name())) 76 suite.addTest(BenchmarkOptionsTest(benchmark.Name()))
78 suite.addTest(TestNoBenchmarkNamesDuplication()) 77 suite.addTest(TestNoBenchmarkNamesDuplication())
79 suite.addTest(TestNoOverrideCustomizeBrowserOptions()) 78 suite.addTest(TestNoOverrideCustomizeBrowserOptions())
80 79
81 80
82 def load_tests(loader, standard_tests, pattern): 81 def load_tests(loader, standard_tests, pattern):
83 del loader, standard_tests, pattern # unused 82 del loader, standard_tests, pattern # unused
84 suite = progress_reporter.TestSuite() 83 suite = progress_reporter.TestSuite()
85 _AddBenchmarkOptionsTests(suite) 84 _AddBenchmarkOptionsTests(suite)
86 return suite 85 return suite
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/benchmark_smoke_unittest.py ('k') | tools/perf/benchmarks/skpicture_printer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698