| OLD | NEW |
| 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 every benchmark that has a composable measurement. | 5 """Run the first page of every benchmark that has a composable measurement. |
| 6 | 6 |
| 7 Ideally this test would be comprehensive, but the above serves as a | 7 Ideally this test would be comprehensive, but the above serves as a |
| 8 kind of smoke test. | 8 kind of smoke test. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import os | 11 import os |
| 12 import unittest | 12 import unittest |
| 13 | 13 |
| 14 from telemetry import benchmark as benchmark_module | 14 from telemetry import benchmark as benchmark_module |
| 15 from telemetry.core import discover | 15 from telemetry.core import discover |
| 16 from telemetry.page import page_test | 16 from telemetry.page import page_test |
| 17 from telemetry.unittest import options_for_unittests | 17 from telemetry.unittest import options_for_unittests |
| 18 from telemetry.unittest import progress_reporter | 18 from telemetry.unittest import output_formatter |
| 19 | 19 |
| 20 | 20 |
| 21 def SmokeTestGenerator(benchmark): | 21 def SmokeTestGenerator(benchmark): |
| 22 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. | 22 # NOTE TO SHERIFFS: DO NOT DISABLE THIS TEST. |
| 23 # | 23 # |
| 24 # This smoke test dynamically tests all benchmarks. So disabling it for one | 24 # This smoke test dynamically tests all benchmarks. So disabling it for one |
| 25 # failing or flaky benchmark would disable a much wider swath of coverage | 25 # failing or flaky benchmark would disable a much wider swath of coverage |
| 26 # than is usally intended. Instead, if a particular benchmark is failing, | 26 # than is usally intended. Instead, if a particular benchmark is failing, |
| 27 # disable it in tools/perf/benchmarks/*. | 27 # disable it in tools/perf/benchmarks/*. |
| 28 @benchmark_module.Disabled('chromeos') # crbug.com/351114 | 28 @benchmark_module.Disabled('chromeos') # crbug.com/351114 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 52 benchmark.ProcessCommandLineArgs(None, options) | 52 benchmark.ProcessCommandLineArgs(None, options) |
| 53 benchmark_module.ProcessCommandLineArgs(None, options) | 53 benchmark_module.ProcessCommandLineArgs(None, options) |
| 54 | 54 |
| 55 self.assertEqual(0, SinglePageBenchmark().Run(options), | 55 self.assertEqual(0, SinglePageBenchmark().Run(options), |
| 56 msg='Failed: %s' % benchmark) | 56 msg='Failed: %s' % benchmark) |
| 57 | 57 |
| 58 return BenchmarkSmokeTest | 58 return BenchmarkSmokeTest |
| 59 | 59 |
| 60 | 60 |
| 61 def load_tests(_, _2, _3): | 61 def load_tests(_, _2, _3): |
| 62 suite = progress_reporter.TestSuite() | 62 suite = output_formatter.TestSuite() |
| 63 | 63 |
| 64 benchmarks_dir = os.path.dirname(__file__) | 64 benchmarks_dir = os.path.dirname(__file__) |
| 65 top_level_dir = os.path.dirname(benchmarks_dir) | 65 top_level_dir = os.path.dirname(benchmarks_dir) |
| 66 measurements_dir = os.path.join(top_level_dir, 'measurements') | 66 measurements_dir = os.path.join(top_level_dir, 'measurements') |
| 67 | 67 |
| 68 all_measurements = discover.DiscoverClasses( | 68 all_measurements = discover.DiscoverClasses( |
| 69 measurements_dir, top_level_dir, page_test.PageTest, | 69 measurements_dir, top_level_dir, page_test.PageTest, |
| 70 pattern='*.py').values() | 70 pattern='*.py').values() |
| 71 all_benchmarks = discover.DiscoverClasses( | 71 all_benchmarks = discover.DiscoverClasses( |
| 72 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, | 72 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 85 if hasattr(benchmark, 'generated_profile_archive'): | 85 if hasattr(benchmark, 'generated_profile_archive'): |
| 86 # We'd like to test these, but don't know how yet. | 86 # We'd like to test these, but don't know how yet. |
| 87 continue | 87 continue |
| 88 | 88 |
| 89 class BenchmarkSmokeTest(unittest.TestCase): | 89 class BenchmarkSmokeTest(unittest.TestCase): |
| 90 pass | 90 pass |
| 91 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark)) | 91 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark)) |
| 92 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 92 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
| 93 | 93 |
| 94 return suite | 94 return suite |
| OLD | NEW |