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

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

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