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

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

Issue 999583002: patch from issue 998693002 at patchset 60001 (http://crrev.com/998693002#ps60001) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify benchmark_smoke_unittest to run all benchmark with PolymerTopeka page Created 5 years, 9 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/page_sets/data/key_silk_cases.json » ('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 unittest 13 import unittest
14 14
15 from telemetry import benchmark as benchmark_module 15 from telemetry import benchmark as benchmark_module
16 from telemetry.core import discover 16 from telemetry.core import discover
17 from telemetry.page import page_test 17 from telemetry.page import page_test
18 from telemetry.unittest_util import options_for_unittests 18 from telemetry.unittest_util import options_for_unittests
19 from telemetry.unittest_util import progress_reporter 19 from telemetry.unittest_util import progress_reporter
20 20
21 from page_sets import key_silk_cases
21 22
22 def SmokeTestGenerator(benchmark): 23 def SmokeTestGenerator(benchmark):
23 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. 24 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST.
24 # 25 #
25 # This smoke test dynamically tests all benchmarks. So disabling it for one 26 # 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 27 # failing or flaky benchmark would disable a much wider swath of coverage
27 # than is usally intended. Instead, if a particular benchmark is failing, 28 # than is usally intended. Instead, if a particular benchmark is failing,
28 # disable it in tools/perf/benchmarks/*. 29 # disable it in tools/perf/benchmarks/*.
29 @benchmark_module.Disabled('chromeos') # crbug.com/351114 30 @benchmark_module.Disabled('chromeos') # crbug.com/351114
30 def BenchmarkSmokeTest(self): 31 def BenchmarkSmokeTest(self):
31 # Only measure a single page so that this test cycles reasonably quickly. 32 # Only measure a single page so that this test cycles reasonably quickly.
32 benchmark.options['pageset_repeat'] = 1 33 benchmark.options['pageset_repeat'] = 1
33 benchmark.options['page_repeat'] = 1 34 benchmark.options['page_repeat'] = 1
34 35
35 class SinglePageBenchmark(benchmark): # pylint: disable=W0232 36 class SinglePageBenchmark(benchmark): # pylint: disable=W0232
36 def CreatePageSet(self, options): 37 def CreatePageSet(self, options):
37 # pylint: disable=E1002 38 # pylint: disable=E1002
38 ps = super(SinglePageBenchmark, self).CreatePageSet(options) 39 ps = super(SinglePageBenchmark, self).CreatePageSet(options)
39 for p in ps.pages: 40 # Only run PolymerTopeka page.
40 p.skip_waits = True 41 all_pages = ps.user_stories[:]
41 ps.user_stories = [p] 42 for p in all_pages:
42 break 43 if not isinstance(p, key_silk_cases.PolymerTopeka):
44 ps.RemoveUserStory(p)
43 return ps 45 return ps
44 46
45 # Set the benchmark's default arguments. 47 # Set the benchmark's default arguments.
46 options = options_for_unittests.GetCopy() 48 options = options_for_unittests.GetCopy()
47 options.output_format = 'none' 49 options.output_format = 'none'
48 options.suppress_gtest_report = True 50 options.suppress_gtest_report = True
51 options.upload_results = False
49 parser = options.CreateParser() 52 parser = options.CreateParser()
50 53
51 benchmark.AddCommandLineArgs(parser) 54 benchmark.AddCommandLineArgs(parser)
52 benchmark_module.AddCommandLineArgs(parser) 55 benchmark_module.AddCommandLineArgs(parser)
53 benchmark.SetArgumentDefaults(parser) 56 benchmark.SetArgumentDefaults(parser)
54 options.MergeDefaultValues(parser.get_default_values()) 57 options.MergeDefaultValues(parser.get_default_values())
55 58
56 benchmark.ProcessCommandLineArgs(None, options) 59 benchmark.ProcessCommandLineArgs(None, options)
57 benchmark_module.ProcessCommandLineArgs(None, options) 60 benchmark_module.ProcessCommandLineArgs(None, options)
58 61
59 self.assertEqual(0, SinglePageBenchmark().Run(options), 62 self.assertEqual(0, SinglePageBenchmark().Run(options),
60 msg='Failed: %s' % benchmark) 63 msg='Failed: %s' % benchmark)
61 64
62 return BenchmarkSmokeTest 65 return BenchmarkSmokeTest
63 66
64 67
65 def load_tests(_, _2, _3): 68 def load_tests(_, _2, _3):
66 suite = progress_reporter.TestSuite() 69 suite = progress_reporter.TestSuite()
67 70
68 benchmarks_dir = os.path.dirname(__file__) 71 benchmarks_dir = os.path.dirname(__file__)
69 top_level_dir = os.path.dirname(benchmarks_dir) 72 top_level_dir = os.path.dirname(benchmarks_dir)
70 measurements_dir = os.path.join(top_level_dir, 'measurements') 73 measurements_dir = os.path.join(top_level_dir, 'measurements')
71 74
72 all_measurements = discover.DiscoverClasses( 75 all_measurements = discover.DiscoverClasses(
73 measurements_dir, top_level_dir, page_test.PageTest).values() 76 measurements_dir, top_level_dir, page_test.PageTest).values()
74 # Using the default of |index_by_class_name=False| means that if a module 77 # Using the default of |index_by_class_name=False| means that if a module
75 # has multiple benchmarks, only the last one is returned. 78 # has multiple benchmarks, only the last one is returned.
76 all_benchmarks = discover.DiscoverClasses( 79 all_benchmarks = discover.DiscoverClasses(
77 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, 80 benchmarks_dir, top_level_dir, benchmark_module.Benchmark,
78 index_by_class_name=False).values() 81 index_by_class_name=True).values()
79 for benchmark in all_benchmarks: 82 for benchmark in all_benchmarks:
80 if hasattr(benchmark, 'test') and benchmark.test not in all_measurements: 83 if hasattr(benchmark, 'test') and benchmark.test not in all_measurements:
81 # If the benchmark does not have a measurement, then it is not composable. 84 # If the benchmark does not have a measurement, then it is not composable.
82 # Ideally we'd like to test these as well, but the non-composable 85 # Ideally we'd like to test these as well, but the non-composable
83 # benchmarks are usually long-running benchmarks. 86 # benchmarks are usually long-running benchmarks.
84 continue 87 continue
85 88
86 # TODO(tonyg): Smoke doesn't work with session_restore yet. 89 # TODO(tonyg): Smoke doesn't work with session_restore yet.
87 if (benchmark.Name().startswith('session_restore') or 90 if (benchmark.Name().startswith('session_restore') or
88 benchmark.Name().startswith('skpicture_printer')): 91 benchmark.Name().startswith('skpicture_printer')):
(...skipping 16 matching lines...) Expand all
105 # in a class, and then throw the ones we don't need away instead. 108 # in a class, and then throw the ones we don't need away instead.
106 if hasattr(benchmark, '_enabled_strings'): 109 if hasattr(benchmark, '_enabled_strings'):
107 method._enabled_strings = benchmark._enabled_strings 110 method._enabled_strings = benchmark._enabled_strings
108 if hasattr(benchmark, '_disabled_strings'): 111 if hasattr(benchmark, '_disabled_strings'):
109 method._disabled_strings = benchmark._disabled_strings 112 method._disabled_strings = benchmark._disabled_strings
110 setattr(BenchmarkSmokeTest, benchmark.Name(), method) 113 setattr(BenchmarkSmokeTest, benchmark.Name(), method)
111 114
112 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) 115 suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
113 116
114 return suite 117 return suite
OLDNEW
« no previous file with comments | « no previous file | tools/perf/page_sets/data/key_silk_cases.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698