| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 # pylint: disable=super-on-old-class | 68 # pylint: disable=super-on-old-class |
| 69 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) | 69 story_set = super(SinglePageBenchmark, self).CreateStorySet(options) |
| 70 assert story_to_smoke_test in story_set.stories | 70 assert story_to_smoke_test in story_set.stories |
| 71 story_set.stories = [story_to_smoke_test] | 71 story_set.stories = [story_to_smoke_test] |
| 72 return story_set | 72 return story_set |
| 73 | 73 |
| 74 options = GenerateBenchmarkOptions(benchmark_class) | 74 options = GenerateBenchmarkOptions(benchmark_class) |
| 75 possible_browser = browser_finder.FindBrowser(options) | 75 possible_browser = browser_finder.FindBrowser(options) |
| 76 if possible_browser is None: | 76 if possible_browser is None: |
| 77 self.skipTest('Cannot find the browser to run the test.') | 77 self.skipTest('Cannot find the browser to run the test.') |
| 78 |
| 78 if (SinglePageBenchmark.ShouldDisable(possible_browser) or | 79 if (SinglePageBenchmark.ShouldDisable(possible_browser) or |
| 79 not decorators.IsEnabled(benchmark_class, possible_browser)[0]): | 80 not decorators.IsEnabled(benchmark_class, possible_browser)[0]): |
| 80 self.skipTest('Benchmark %s is disabled' % SinglePageBenchmark.Name()) | 81 self.skipTest('Benchmark %s is disabled' % SinglePageBenchmark.Name()) |
| 81 | 82 |
| 83 if not story_to_smoke_test.CanRun(possible_browser): |
| 84 self.skipTest('Story %s is disabled' % story_to_smoke_test.name) |
| 85 |
| 82 if self.id() in _DISABLED_TESTS: | 86 if self.id() in _DISABLED_TESTS: |
| 83 self.skipTest('Test is explictly disabled') | 87 self.skipTest('Test is explictly disabled') |
| 84 | 88 |
| 85 self.assertEqual(0, SinglePageBenchmark().Run(options), | 89 self.assertEqual(0, SinglePageBenchmark().Run(options), |
| 86 msg='Failed: %s' % benchmark_class) | 90 msg='Failed: %s' % benchmark_class) |
| 87 | 91 |
| 88 # We attach the test method to SystemHealthBenchmarkSmokeTest dynamically | 92 # We attach the test method to SystemHealthBenchmarkSmokeTest dynamically |
| 89 # so that we can set the test method name to include | 93 # so that we can set the test method name to include |
| 90 # '<benchmark class name>.<story display name>'. | 94 # '<benchmark class name>.<story display name>'. |
| 91 test_method_name = '%s.%s' % ( | 95 test_method_name = '%s.%s' % ( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 # parsed during test time which happens after load_tests are called. | 141 # parsed during test time which happens after load_tests are called. |
| 138 # Since none of our system health benchmarks creates stories based on | 142 # Since none of our system health benchmarks creates stories based on |
| 139 # command line options, it should be ok to pass options=None to | 143 # command line options, it should be ok to pass options=None to |
| 140 # CreateStorySet. | 144 # CreateStorySet. |
| 141 for story_to_smoke_test in ( | 145 for story_to_smoke_test in ( |
| 142 benchmark_class().CreateStorySet(options=None).stories): | 146 benchmark_class().CreateStorySet(options=None).stories): |
| 143 suite.addTest( | 147 suite.addTest( |
| 144 _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test)) | 148 _GenerateSmokeTestCase(benchmark_class, story_to_smoke_test)) |
| 145 | 149 |
| 146 return suite | 150 return suite |
| OLD | NEW |