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

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

Issue 2429273003: [tools/perf] Enable outputting trace, videos (Android only), result2.html for system health stories…
Patch Set: Created 4 years, 2 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
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 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 all system health stories used by system health benchmarks. 5 """Run all system health stories used by system health benchmarks.
6 6
7 Only memory benchmarks are used when running these stories to make the total 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 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). 9 stories as memory ones, only with fewer actions (no memory dumping).
10 """ 10 """
11 11
12 import unittest 12 import unittest
13 import os
13 14
14 from core import perf_benchmark 15 from core import perf_benchmark
15 16
16 from telemetry import benchmark as benchmark_module 17 from telemetry import benchmark as benchmark_module
17 from telemetry import decorators 18 from telemetry import decorators
18 from telemetry.core import discover 19 from telemetry.core import discover
19 from telemetry.internal.browser import browser_finder 20 from telemetry.internal.browser import browser_finder
20 from telemetry.testing import options_for_unittests 21 from telemetry.testing import options_for_unittests
21 from telemetry.testing import progress_reporter 22 from telemetry.testing import progress_reporter
22 23
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 67
67 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. 68 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST.
68 # 69 #
69 # This smoke test dynamically tests all system health user stories. So 70 # This smoke test dynamically tests all system health user stories. So
70 # disabling it for one failing or flaky benchmark would disable a much 71 # disabling it for one failing or flaky benchmark would disable a much
71 # wider swath of coverage than is usally intended. Instead, if a test is 72 # wider swath of coverage than is usally intended. Instead, if a test is
72 # failing, disable it by putting it into the _DISABLED_TESTS list above. 73 # failing, disable it by putting it into the _DISABLED_TESTS list above.
73 @benchmark_module.Disabled('chromeos') # crbug.com/351114 74 @benchmark_module.Disabled('chromeos') # crbug.com/351114
74 def RunTest(self): 75 def RunTest(self):
75 76
76 class SinglePageBenchmark(benchmark_class): # pylint: disable=no-init 77 class SingleStoryBenchmark(benchmark_class): # pylint: disable=no-init
77 def CreateStorySet(self, options): 78 def CreateStorySet(self, options):
78 # pylint: disable=super-on-old-class 79 # pylint: disable=super-on-old-class
79 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) 80 story_set = super(SingleStoryBenchmark, self).CreateStorySet(options)
80 assert story_to_smoke_test in story_set.stories 81 assert story_to_smoke_test in story_set.stories
81 story_set.stories = [story_to_smoke_test] 82 story_set.stories = [story_to_smoke_test]
82 return story_set 83 return story_set
83 84
84 options = GenerateBenchmarkOptions(benchmark_class) 85 options = GenerateBenchmarkOptions(benchmark_class)
85 possible_browser = browser_finder.FindBrowser(options) 86 possible_browser = browser_finder.FindBrowser(options)
86 if possible_browser is None: 87 if possible_browser is None:
87 self.skipTest('Cannot find the browser to run the test.') 88 self.skipTest('Cannot find the browser to run the test.')
88 if (SinglePageBenchmark.ShouldDisable(possible_browser) or 89 if (SingleStoryBenchmark.ShouldDisable(possible_browser) or
89 not decorators.IsEnabled(benchmark_class, possible_browser)[0]): 90 not decorators.IsEnabled(benchmark_class, possible_browser)[0]):
90 self.skipTest('Benchmark %s is disabled' % SinglePageBenchmark.Name()) 91 self.skipTest('Benchmark %s is disabled' % SingleStoryBenchmark.Name())
91 92
92 if self.id() in _DISABLED_TESTS: 93 if self.id() in _DISABLED_TESTS:
93 self.skipTest('Test is explictly disabled') 94 self.skipTest('Test is explictly disabled')
94 95
95 self.assertEqual(0, SinglePageBenchmark().Run(options), 96 # If this is run on swarming, dump all the data to ${ISOLATED_OUTDIR} to
97 # archive them.
98 if os.environ.get('ISOLATED_OUTDIR'):
99 if possible_browser.platform.GetOSName() == 'android':
100 options.profiler = 'android-screen-recorder'
101 system_health_dir = os.path.join(
102 os.path.abspath(os.environ.get('ISOLATED_OUTDIR')),
103 'system_health_smoke')
104 # Create system_health_dir if not already exists (this could be racey
105 # hence we just ignore OSError).
106 try:
107 os.mkdir(system_health_dir)
108 except OSError:
109 pass
110 options.output_dir = os.path.join(system_health_dir,
111 story_to_smoke_test.file_safe_name)
112 os.mkdir(options.output_dir)
113 options.output_formats = ['json', 'html2']
114 self.assertEqual(0, SingleStoryBenchmark().Run(options),
96 msg='Failed: %s' % benchmark_class) 115 msg='Failed: %s' % benchmark_class)
97 116
98 # We attach the test method to SystemHealthBenchmarkSmokeTest dynamically 117 # We attach the test method to SystemHealthBenchmarkSmokeTest dynamically
99 # so that we can set the test method name to include 118 # so that we can set the test method name to include
100 # '<benchmark class name>.<story display name>'. 119 # '<benchmark class name>.<story display name>'.
101 test_method_name = '%s.%s' % ( 120 test_method_name = '%s.%s' % (
102 benchmark_class.Name(), story_to_smoke_test.display_name) 121 benchmark_class.Name(), story_to_smoke_test.display_name)
103 122
104 class SystemHealthBenchmarkSmokeTest(unittest.TestCase): 123 class SystemHealthBenchmarkSmokeTest(unittest.TestCase):
105 pass 124 pass
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 # parsed during test time which happens after load_tests are called. 166 # parsed during test time which happens after load_tests are called.
148 # Since none of our system health benchmarks creates stories based on 167 # Since none of our system health benchmarks creates stories based on
149 # command line options, it should be ok to pass options=None to 168 # command line options, it should be ok to pass options=None to
150 # CreateStorySet. 169 # CreateStorySet.
151 for story_to_smoke_test in ( 170 for story_to_smoke_test in (
152 benchmark_class().CreateStorySet(options=None).stories): 171 benchmark_class().CreateStorySet(options=None).stories):
153 suite.addTest( 172 suite.addTest(
154 _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test)) 173 _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test))
155 174
156 return suite 175 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