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

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

Issue 1152763002: Fix tab_switching measurement bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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/measurements/tab_switching.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 """
(...skipping 12 matching lines...) Expand all
23 from benchmarks import jetstream 23 from benchmarks import jetstream
24 from benchmarks import kraken 24 from benchmarks import kraken
25 from benchmarks import octane 25 from benchmarks import octane
26 from benchmarks import rasterize_and_record_micro 26 from benchmarks import rasterize_and_record_micro
27 from benchmarks import repaint 27 from benchmarks import repaint
28 from benchmarks import spaceport 28 from benchmarks import spaceport
29 from benchmarks import speedometer 29 from benchmarks import speedometer
30 from benchmarks import sunspider 30 from benchmarks import sunspider
31 31
32 32
33 def SmokeTestGenerator(benchmark): 33 def SmokeTestGenerator(benchmark, num_pages=1):
34 """Generates a benchmark that includes first N pages from pageset."""
34 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. 35 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST.
35 # 36 #
36 # This smoke test dynamically tests all benchmarks. So disabling it for one 37 # This smoke test dynamically tests all benchmarks. So disabling it for one
37 # failing or flaky benchmark would disable a much wider swath of coverage 38 # failing or flaky benchmark would disable a much wider swath of coverage
38 # than is usally intended. Instead, if a particular benchmark is failing, 39 # than is usally intended. Instead, if a particular benchmark is failing,
39 # disable it in tools/perf/benchmarks/*. 40 # disable it in tools/perf/benchmarks/*.
40 @benchmark_module.Disabled('chromeos') # crbug.com/351114 41 @benchmark_module.Disabled('chromeos') # crbug.com/351114
41 def BenchmarkSmokeTest(self): 42 def BenchmarkSmokeTest(self):
42 # Only measure a single page so that this test cycles reasonably quickly. 43 # Only measure a single page so that this test cycles reasonably quickly.
43 benchmark.options['pageset_repeat'] = 1 44 benchmark.options['pageset_repeat'] = 1
44 benchmark.options['page_repeat'] = 1 45 benchmark.options['page_repeat'] = 1
45 46
46 class SinglePageBenchmark(benchmark): # pylint: disable=W0232 47 class SinglePageBenchmark(benchmark): # pylint: disable=W0232
47 def CreateStorySet(self, options): 48 def CreateStorySet(self, options):
48 # pylint: disable=E1002 49 # pylint: disable=E1002
49 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) 50 story_set = super(SinglePageBenchmark, self).CreateStorySet(options)
50 for story in story_set.stories: 51 stories = []
52 for story in story_set.stories[:num_pages]:
51 story.skip_waits = True 53 story.skip_waits = True
52 story_set.stories = [story] 54 stories.append(story)
53 break 55 story_set.stories = stories
54 return story_set 56 return story_set
55 57
56 # Set the benchmark's default arguments. 58 # Set the benchmark's default arguments.
57 options = options_for_unittests.GetCopy() 59 options = options_for_unittests.GetCopy()
58 options.output_format = 'none' 60 options.output_format = 'none'
59 options.suppress_gtest_report = True 61 options.suppress_gtest_report = True
60 parser = options.CreateParser() 62 parser = options.CreateParser()
61 63
62 benchmark.AddCommandLineArgs(parser) 64 benchmark.AddCommandLineArgs(parser)
63 benchmark_module.AddCommandLineArgs(parser) 65 benchmark_module.AddCommandLineArgs(parser)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 benchmark.Name().startswith('skpicture_printer')): 115 benchmark.Name().startswith('skpicture_printer')):
114 continue 116 continue
115 117
116 if hasattr(benchmark, 'generated_profile_archive'): 118 if hasattr(benchmark, 'generated_profile_archive'):
117 # We'd like to test these, but don't know how yet. 119 # We'd like to test these, but don't know how yet.
118 continue 120 continue
119 121
120 class BenchmarkSmokeTest(unittest.TestCase): 122 class BenchmarkSmokeTest(unittest.TestCase):
121 pass 123 pass
122 124
123 method = SmokeTestGenerator(benchmark) 125 # It is wrong to give tab_switching only one page to switch.
126 if 'tab_switching' in benchmark.Name():
127 method = SmokeTestGenerator(benchmark, num_pages=2)
128 else:
129 method = SmokeTestGenerator(benchmark)
124 130
125 # Make sure any decorators are propagated from the original declaration. 131 # Make sure any decorators are propagated from the original declaration.
126 # (access to protected members) pylint: disable=W0212 132 # (access to protected members) pylint: disable=W0212
127 # TODO(dpranke): Since we only pick the first test from every class 133 # TODO(dpranke): Since we only pick the first test from every class
128 # (above), if that test is disabled, we'll end up not running *any* 134 # (above), if that test is disabled, we'll end up not running *any*
129 # test from the class. We should probably discover all of the tests 135 # test from the class. We should probably discover all of the tests
130 # in a class, and then throw the ones we don't need away instead. 136 # in a class, and then throw the ones we don't need away instead.
131 137
132 # Merge decorators. 138 # Merge decorators.
133 for attribute in ['_enabled_strings', '_disabled_strings']: 139 for attribute in ['_enabled_strings', '_disabled_strings']:
(...skipping 10 matching lines...) Expand all
144 150
145 # Disable some tests on android platform only. 151 # Disable some tests on android platform only.
146 if sys.modules[benchmark.__module__] in _ANDROID_BLACK_LIST_MODULES: 152 if sys.modules[benchmark.__module__] in _ANDROID_BLACK_LIST_MODULES:
147 method._disabled_strings.append('android') 153 method._disabled_strings.append('android')
148 154
149 setattr(BenchmarkSmokeTest, benchmark.Name(), method) 155 setattr(BenchmarkSmokeTest, benchmark.Name(), method)
150 156
151 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) 157 suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
152 158
153 return suite 159 return suite
OLDNEW
« no previous file with comments | « no previous file | tools/perf/measurements/tab_switching.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698