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

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

Issue 1144193002: Enable more benchmark_smoke_unittest coverage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Blacklist dom_perf instead of blink_perf 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 | tools/telemetry/telemetry/user_story/user_story_set.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 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 """
11 11
12 import os 12 import os
13 import sys
14 import time
13 import unittest 15 import unittest
14 16
15 from telemetry import benchmark as benchmark_module 17 from telemetry import benchmark as benchmark_module
16 from telemetry.core import discover 18 from telemetry.core import discover
17 from telemetry.page import page_test
18 from telemetry.unittest_util import options_for_unittests 19 from telemetry.unittest_util import options_for_unittests
19 from telemetry.unittest_util import progress_reporter 20 from telemetry.unittest_util import progress_reporter
20 21
22 from benchmarks import dom_perf
23 from benchmarks import rasterize_and_record_micro
24 from benchmarks import spaceport
25 from benchmarks import speedometer
26 from benchmarks import jetstream
27
21 28
22 def SmokeTestGenerator(benchmark): 29 def SmokeTestGenerator(benchmark):
23 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. 30 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST.
24 # 31 #
25 # This smoke test dynamically tests all benchmarks. So disabling it for one 32 # This smoke test dynamically tests all benchmarks. So disabling it for one
26 # failing or flaky benchmark would disable a much wider swath of coverage 33 # failing or flaky benchmark would disable a much wider swath of coverage
27 # than is usally intended. Instead, if a particular benchmark is failing, 34 # than is usally intended. Instead, if a particular benchmark is failing,
28 # disable it in tools/perf/benchmarks/*. 35 # disable it in tools/perf/benchmarks/*.
29 @benchmark_module.Disabled('chromeos') # crbug.com/351114 36 @benchmark_module.Disabled('chromeos') # crbug.com/351114
30 def BenchmarkSmokeTest(self): 37 def BenchmarkSmokeTest(self):
(...skipping 18 matching lines...) Expand all
49 parser = options.CreateParser() 56 parser = options.CreateParser()
50 57
51 benchmark.AddCommandLineArgs(parser) 58 benchmark.AddCommandLineArgs(parser)
52 benchmark_module.AddCommandLineArgs(parser) 59 benchmark_module.AddCommandLineArgs(parser)
53 benchmark.SetArgumentDefaults(parser) 60 benchmark.SetArgumentDefaults(parser)
54 options.MergeDefaultValues(parser.get_default_values()) 61 options.MergeDefaultValues(parser.get_default_values())
55 62
56 benchmark.ProcessCommandLineArgs(None, options) 63 benchmark.ProcessCommandLineArgs(None, options)
57 benchmark_module.ProcessCommandLineArgs(None, options) 64 benchmark_module.ProcessCommandLineArgs(None, options)
58 65
59 self.assertEqual(0, SinglePageBenchmark().Run(options), 66 current = time.time()
60 msg='Failed: %s' % benchmark) 67 try:
68 self.assertEqual(0, SinglePageBenchmark().Run(options),
69 msg='Failed: %s' % benchmark)
70 finally:
71 print 'Benchmark %s run takes %i seconds' % (
72 benchmark.Name(), time.time() - current)
61 73
62 return BenchmarkSmokeTest 74 return BenchmarkSmokeTest
63 75
64 76
77 # The list of benchmark modules to be excluded from our smoke tests.
78 _BLACK_LIST_TEST_MODULES = {
79 dom_perf, # Always fails on cq bot.
80 rasterize_and_record_micro, # Always fails on cq bot.
81 spaceport, # Takes 451 seconds.
82 speedometer, # Takes 101 seconds.
83 jetstream, # Take 206 seconds.
84 }
85
86
65 def load_tests(loader, standard_tests, pattern): 87 def load_tests(loader, standard_tests, pattern):
66 del loader, standard_tests, pattern # unused 88 del loader, standard_tests, pattern # unused
67 suite = progress_reporter.TestSuite() 89 suite = progress_reporter.TestSuite()
68 90
69 benchmarks_dir = os.path.dirname(__file__) 91 benchmarks_dir = os.path.dirname(__file__)
70 top_level_dir = os.path.dirname(benchmarks_dir) 92 top_level_dir = os.path.dirname(benchmarks_dir)
71 measurements_dir = os.path.join(top_level_dir, 'measurements')
72 93
73 all_measurements = discover.DiscoverClasses(
74 measurements_dir, top_level_dir, page_test.PageTest).values()
75 # Using the default of |index_by_class_name=False| means that if a module 94 # Using the default of |index_by_class_name=False| means that if a module
76 # has multiple benchmarks, only the last one is returned. 95 # has multiple benchmarks, only the last one is returned.
77 all_benchmarks = discover.DiscoverClasses( 96 all_benchmarks = discover.DiscoverClasses(
78 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, 97 benchmarks_dir, top_level_dir, benchmark_module.Benchmark,
79 index_by_class_name=False).values() 98 index_by_class_name=False).values()
80 for benchmark in all_benchmarks: 99 for benchmark in all_benchmarks:
81 if hasattr(benchmark, 'test') and benchmark.test not in all_measurements: 100 if sys.modules[benchmark.__module__] in _BLACK_LIST_TEST_MODULES:
82 # If the benchmark does not have a measurement, then it is not composable.
83 # Ideally we'd like to test these as well, but the non-composable
84 # benchmarks are usually long-running benchmarks.
85 continue 101 continue
86
87 # TODO(tonyg): Smoke doesn't work with session_restore yet. 102 # TODO(tonyg): Smoke doesn't work with session_restore yet.
88 if (benchmark.Name().startswith('session_restore') or 103 if (benchmark.Name().startswith('session_restore') or
89 benchmark.Name().startswith('skpicture_printer')): 104 benchmark.Name().startswith('skpicture_printer')):
90 continue 105 continue
91 106
92 if hasattr(benchmark, 'generated_profile_archive'): 107 if hasattr(benchmark, 'generated_profile_archive'):
93 # We'd like to test these, but don't know how yet. 108 # We'd like to test these, but don't know how yet.
94 continue 109 continue
95 110
96 class BenchmarkSmokeTest(unittest.TestCase): 111 class BenchmarkSmokeTest(unittest.TestCase):
(...skipping 19 matching lines...) Expand all
116 # Handle the case where the benchmark is Enabled/Disabled everywhere. 131 # Handle the case where the benchmark is Enabled/Disabled everywhere.
117 if (getattr(method, attribute, None) == [] or 132 if (getattr(method, attribute, None) == [] or
118 getattr(benchmark, attribute, None) == []): 133 getattr(benchmark, attribute, None) == []):
119 setattr(method, attribute, []) 134 setattr(method, attribute, [])
120 135
121 setattr(BenchmarkSmokeTest, benchmark.Name(), method) 136 setattr(BenchmarkSmokeTest, benchmark.Name(), method)
122 137
123 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) 138 suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
124 139
125 return suite 140 return suite
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/telemetry/user_story/user_story_set.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698