| OLD | NEW |
| 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 """ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 # disabling it for one failing or flaky benchmark would disable a much | 63 # disabling it for one failing or flaky benchmark would disable a much |
| 64 # wider swath of coverage than is usally intended. Instead, if a test is | 64 # wider swath of coverage than is usally intended. Instead, if a test is |
| 65 # failing, disable it by putting it into the _DISABLED_TESTS list above. | 65 # failing, disable it by putting it into the _DISABLED_TESTS list above. |
| 66 @benchmark_module.Disabled('chromeos') # crbug.com/351114 | 66 @benchmark_module.Disabled('chromeos') # crbug.com/351114 |
| 67 def RunTest(self): | 67 def RunTest(self): |
| 68 | 68 |
| 69 class SinglePageBenchmark(benchmark_class): # pylint: disable=no-init | 69 class SinglePageBenchmark(benchmark_class): # pylint: disable=no-init |
| 70 def CreateStorySet(self, options): | 70 def CreateStorySet(self, options): |
| 71 # pylint: disable=super-on-old-class | 71 # pylint: disable=super-on-old-class |
| 72 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) | 72 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) |
| 73 assert story_to_smoke_test in story_set.stories | 73 stories_to_remove = [s for s in story_set.stories if s != |
| 74 story_set.stories = [story_to_smoke_test] | 74 story_to_smoke_test] |
| 75 for s in stories_to_remove: |
| 76 story_set.RemoveStory(s) |
| 77 assert story_set.stories |
| 75 return story_set | 78 return story_set |
| 76 | 79 |
| 77 options = GenerateBenchmarkOptions(benchmark_class) | 80 options = GenerateBenchmarkOptions(benchmark_class) |
| 78 possible_browser = browser_finder.FindBrowser(options) | 81 possible_browser = browser_finder.FindBrowser(options) |
| 79 if possible_browser is None: | 82 if possible_browser is None: |
| 80 self.skipTest('Cannot find the browser to run the test.') | 83 self.skipTest('Cannot find the browser to run the test.') |
| 81 if (SinglePageBenchmark.ShouldDisable(possible_browser) or | 84 if (SinglePageBenchmark.ShouldDisable(possible_browser) or |
| 82 not decorators.IsEnabled(benchmark_class, possible_browser)[0]): | 85 not decorators.IsEnabled(benchmark_class, possible_browser)[0]): |
| 83 self.skipTest('Benchmark %s is disabled' % SinglePageBenchmark.Name()) | 86 self.skipTest('Benchmark %s is disabled' % SinglePageBenchmark.Name()) |
| 84 | 87 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 # parsed during test time which happens after load_tests are called. | 143 # parsed during test time which happens after load_tests are called. |
| 141 # Since none of our system health benchmarks creates stories based on | 144 # Since none of our system health benchmarks creates stories based on |
| 142 # command line options, it should be ok to pass options=None to | 145 # command line options, it should be ok to pass options=None to |
| 143 # CreateStorySet. | 146 # CreateStorySet. |
| 144 for story_to_smoke_test in ( | 147 for story_to_smoke_test in ( |
| 145 benchmark_class().CreateStorySet(options=None).stories): | 148 benchmark_class().CreateStorySet(options=None).stories): |
| 146 suite.addTest( | 149 suite.addTest( |
| 147 _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test)) | 150 _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test)) |
| 148 | 151 |
| 149 return suite | 152 return suite |
| OLD | NEW |