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

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

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