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

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

Issue 653233002: Add BenchmarkOptionsTest. Move smoke test to benchmark_smoke_unittest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Have |_GetPerfDir| use __file__ instead of GetChromiumSrcDir Created 6 years, 2 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 | tools/perf/benchmarks/benchmark_unittest.py » ('j') | 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 every benchmark that has a composable measurement. 5 """Run the first page of one benchmark for every module.
6 6
7 Ideally this test would be comprehensive, but the above serves as a 7 Only benchmarks that have a composable measurement are included.
8 kind of smoke test. 8 Ideally this test would be comprehensive, however, running one page
9 of every benchmark would run impractically long.
9 """ 10 """
10 11
11 import os 12 import os
12 import unittest 13 import unittest
13 14
14 from telemetry import benchmark as benchmark_module 15 from telemetry import benchmark as benchmark_module
15 from telemetry.core import discover 16 from telemetry.core import discover
16 from telemetry.page import page_test 17 from telemetry.page import page_test
17 from telemetry.unittest import options_for_unittests 18 from telemetry.unittest import options_for_unittests
18 from telemetry.unittest import progress_reporter 19 from telemetry.unittest import progress_reporter
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 63
63 64
64 def load_tests(_, _2, _3): 65 def load_tests(_, _2, _3):
65 suite = progress_reporter.TestSuite() 66 suite = progress_reporter.TestSuite()
66 67
67 benchmarks_dir = os.path.dirname(__file__) 68 benchmarks_dir = os.path.dirname(__file__)
68 top_level_dir = os.path.dirname(benchmarks_dir) 69 top_level_dir = os.path.dirname(benchmarks_dir)
69 measurements_dir = os.path.join(top_level_dir, 'measurements') 70 measurements_dir = os.path.join(top_level_dir, 'measurements')
70 71
71 all_measurements = discover.DiscoverClasses( 72 all_measurements = discover.DiscoverClasses(
72 measurements_dir, top_level_dir, page_test.PageTest, 73 measurements_dir, top_level_dir, page_test.PageTest).values()
73 pattern='*.py').values() 74 # Using the default of |index_by_class_name=False| means that if a module
75 # has multiple benchmarks, only the last one is returned.
74 all_benchmarks = discover.DiscoverClasses( 76 all_benchmarks = discover.DiscoverClasses(
75 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, 77 benchmarks_dir, top_level_dir, benchmark_module.Benchmark,
76 pattern='*.py').values() 78 index_by_class_name=False).values()
77 for benchmark in all_benchmarks: 79 for benchmark in all_benchmarks:
78 if benchmark.PageTestClass() not in all_measurements: 80 if benchmark.PageTestClass() not in all_measurements:
79 # If the benchmark is not in measurements, then it is not composable. 81 # If the benchmark is not in measurements, then it is not composable.
80 # Ideally we'd like to test these as well, but the non-composable 82 # Ideally we'd like to test these as well, but the non-composable
81 # benchmarks are usually long-running benchmarks. 83 # benchmarks are usually long-running benchmarks.
82 continue 84 continue
83 85
84 # TODO(tonyg): Smoke doesn't work with session_restore yet. 86 # TODO(tonyg): Smoke doesn't work with session_restore yet.
85 if benchmark.Name().startswith('session_restore'): 87 if benchmark.Name().startswith('session_restore'):
86 continue 88 continue
87 89
88 if hasattr(benchmark, 'generated_profile_archive'): 90 if hasattr(benchmark, 'generated_profile_archive'):
89 # We'd like to test these, but don't know how yet. 91 # We'd like to test these, but don't know how yet.
90 continue 92 continue
91 93
92 class BenchmarkSmokeTest(unittest.TestCase): 94 class BenchmarkSmokeTest(unittest.TestCase):
93 pass 95 pass
94 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark)) 96 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark))
95 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) 97 suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
96 98
97 return suite 99 return suite
OLDNEW
« no previous file with comments | « no previous file | tools/perf/benchmarks/benchmark_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698