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

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

Issue 2117533002: Revert of [tools/perf] Add system_health_smoke_test that run all system health stories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Run all system health stories used by system health benchmarks.
6
7 Only memory benchmarks are used when running these stories to make the total
8 cycle time manageable. Other system health benchmarks should be using the same
9 stories as memory ones, only with fewer actions (no memory dumping).
10 """
11
12 import unittest
13
14 from core import perf_benchmark
15
16 from telemetry import benchmark as benchmark_module
17 from telemetry import decorators
18 from telemetry.core import discover
19 from telemetry.internal.browser import browser_finder
20 from telemetry.testing import options_for_unittests
21 from telemetry.testing import progress_reporter
22
23 from benchmarks import system_health
24
25
26 # We only cover memory system health
27 _SH_BENCHMARKS_TO_SMOKE_TEST = [
28 system_health.DesktopMemorySystemHealth,
29 system_health.MobileMemorySystemHealth,
30 ]
31
32
33 def GetSystemHealthBenchmarksToSmokeTest():
34 sh_benchmark_classes = discover.DiscoverClassesInModule(
35 system_health, perf_benchmark.PerfBenchmark,
36 index_by_class_name=True).values()
37 return list(b for b in sh_benchmark_classes if
38 b.Name().startswith('system_health.memory'))
39
40
41 _DISABLED_TESTS = [
42 # crbug.com/624474
43 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_hea lth.memory_desktop.load:tools:dropbox', # pylint: disable=line-too-long
44 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_hea lth.memory_desktop.load:tools:docs', # pylint: disable=line-too-long
45 # crbug.com/624587
46 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_hea lth.memory_desktop.load:search:ebay', # pylint: disable=line-too-long
47 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_hea lth.memory_desktop.load:news:cnn', # pylint: disable=line-too-long
48 # crbug.com/624607
49 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_hea lth.memory_desktop.load:media:dailymotion', # pylint: disable=line-too-long
50 # crbug.com/624701
51 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_hea lth.memory_mobile.load:games:bubbles', # pylint: disable=line-too-long
52 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_hea lth.memory_mobile.load:games:spychase', # pylint: disable=line-too-long
53 'benchmarks.system_health_smoke_test.SystemHealthBenchmarkSmokeTest.system_hea lth.memory_mobile.load:news:cnn', # pylint: disable=line-too-long
54 ]
55
56
57 def _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test):
58
59 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST.
60 #
61 # This smoke test dynamically tests all system health user stories. So
62 # disabling it for one failing or flaky benchmark would disable a much
63 # wider swath of coverage than is usally intended. Instead, if a test is
64 # failing, disable it by putting it into the _DISABLED_TESTS list above.
65 @benchmark_module.Disabled('chromeos') # crbug.com/351114
66 def RunTest(self):
67
68 class SinglePageBenchmark(benchmark_class): # pylint: disable=no-init
69 def CreateStorySet(self, options):
70 # pylint: disable=super-on-old-class
71 story_set = super(SinglePageBenchmark, self).CreateStorySet(options)
72 assert story_to_smoke_test in story_set.stories
73 story_set.stories = [story_to_smoke_test]
74 return story_set
75
76 options = GenerateBenchmarkOptions(benchmark_class)
77 possible_browser = browser_finder.FindBrowser(options)
78 if possible_browser is None:
79 self.skipTest('Cannot find the browser to run the test.')
80 if (SinglePageBenchmark.ShouldDisable(possible_browser) or
81 not decorators.IsEnabled(benchmark_class, possible_browser)[0]):
82 self.skipTest('Benchmark %s is disabled' % SinglePageBenchmark.Name())
83
84 if self.id() in _DISABLED_TESTS:
85 self.skipTest('Test is explictly disabled')
86
87 self.assertEqual(0, SinglePageBenchmark().Run(options),
88 msg='Failed: %s' % benchmark_class)
89
90 # We attach the test method to SystemHealthBenchmarkSmokeTest dynamically
91 # so that we can set the test method name to include
92 # '<benchmark class name>.<story display name>'.
93 test_method_name = '%s.%s' % (
94 benchmark_class.Name(), story_to_smoke_test.display_name)
95
96 class SystemHealthBenchmarkSmokeTest(unittest.TestCase):
97 pass
98
99 setattr(SystemHealthBenchmarkSmokeTest, test_method_name, RunTest)
100
101 return SystemHealthBenchmarkSmokeTest(methodName=test_method_name)
102
103
104 def GenerateBenchmarkOptions(benchmark_class):
105 # Set the benchmark's default arguments.
106 options = options_for_unittests.GetCopy()
107 options.output_format = 'none'
108 parser = options.CreateParser()
109
110 # TODO(nednguyen): probably this logic of setting up the benchmark options
111 # parser & processing the options should be sharable with telemetry's
112 # core.
113 benchmark_class.AddCommandLineArgs(parser)
114 benchmark_module.AddCommandLineArgs(parser)
115 benchmark_class.SetArgumentDefaults(parser)
116 options.MergeDefaultValues(parser.get_default_values())
117
118 benchmark_class.ProcessCommandLineArgs(None, options)
119 benchmark_module.ProcessCommandLineArgs(None, options)
120 # Only measure a single story so that this test cycles reasonably quickly.
121 options.pageset_repeat = 1
122 options.page_repeat = 1
123 return options
124
125
126 def load_tests(loader, standard_tests, pattern):
127 del loader, standard_tests, pattern # unused
128 suite = progress_reporter.TestSuite()
129 benchmark_classes = GetSystemHealthBenchmarksToSmokeTest()
130 assert benchmark_classes, 'This list should never be empty'
131 for benchmark_class in benchmark_classes:
132
133 # HACK: these options should be derived from options_for_unittests which are
134 # the resolved options from run_tests' arguments. However, options is only
135 # parsed during test time which happens after load_tests are called.
136 # Since none of our system health benchmarks creates stories based on
137 # command line options, it should be ok to pass options=None to
138 # CreateStorySet.
139 for story_to_smoke_test in (
140 benchmark_class().CreateStorySet(options=None).stories):
141 suite.addTest(
142 _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test))
143
144 return suite
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698