| 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 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 top_level_dir = os.path.dirname(benchmarks_dir) | 68 top_level_dir = os.path.dirname(benchmarks_dir) |
| 69 measurements_dir = os.path.join(top_level_dir, 'measurements') | 69 measurements_dir = os.path.join(top_level_dir, 'measurements') |
| 70 | 70 |
| 71 all_measurements = discover.DiscoverClasses( | 71 all_measurements = discover.DiscoverClasses( |
| 72 measurements_dir, top_level_dir, page_test.PageTest, | 72 measurements_dir, top_level_dir, page_test.PageTest, |
| 73 pattern='*.py').values() | 73 pattern='*.py').values() |
| 74 all_benchmarks = discover.DiscoverClasses( | 74 all_benchmarks = discover.DiscoverClasses( |
| 75 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, | 75 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, |
| 76 pattern='*.py').values() | 76 pattern='*.py').values() |
| 77 for benchmark in all_benchmarks: | 77 for benchmark in all_benchmarks: |
| 78 if benchmark.PageTestClass() not in all_measurements: | 78 if hasattr(benchmark, 'test') and benchmark.test not in all_measurements: |
| 79 # If the benchmark is not in measurements, then it is not composable. | 79 # If the benchmark is not in measurements, then it is not composable. |
| 80 # Ideally we'd like to test these as well, but the non-composable | 80 # Ideally we'd like to test these as well, but the non-composable |
| 81 # benchmarks are usually long-running benchmarks. | 81 # benchmarks are usually long-running benchmarks. |
| 82 continue | 82 continue |
| 83 | 83 |
| 84 # TODO(tonyg): Smoke doesn't work with session_restore yet. | 84 # TODO(tonyg): Smoke doesn't work with session_restore yet. |
| 85 if benchmark.Name().startswith('session_restore'): | 85 if benchmark.Name().startswith('session_restore'): |
| 86 continue | 86 continue |
| 87 | 87 |
| 88 if hasattr(benchmark, 'generated_profile_archive'): | 88 if hasattr(benchmark, 'generated_profile_archive'): |
| 89 # We'd like to test these, but don't know how yet. | 89 # We'd like to test these, but don't know how yet. |
| 90 continue | 90 continue |
| 91 | 91 |
| 92 class BenchmarkSmokeTest(unittest.TestCase): | 92 class BenchmarkSmokeTest(unittest.TestCase): |
| 93 pass | 93 pass |
| 94 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark)) | 94 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark)) |
| 95 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 95 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
| 96 | 96 |
| 97 return suite | 97 return suite |
| OLD | NEW |