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 test | 14 from telemetry import test |
15 from telemetry.core import discover | 15 from telemetry.core import discover |
16 from telemetry.page import page_measurement | 16 from telemetry.page import page_measurement |
17 from telemetry.unittest import gtest_testrunner | 17 from telemetry.unittest import gtest_testrunner |
18 from telemetry.unittest import options_for_unittests | 18 from telemetry.unittest import options_for_unittests |
19 | 19 |
20 | 20 |
21 def SmokeTestGenerator(benchmark): | 21 def SmokeTestGenerator(benchmark): |
22 # In general you should @test.Disabled individual benchmarks that fail, | 22 # In general you should @test.Disabled individual benchmarks that fail, |
23 # instead of this entire smoke test suite. | 23 # instead of this entire smoke test suite. |
24 # TODO(achuith): Multiple tests failing on CrOS. crbug.com/351114 | 24 # TODO(achuith): Multiple tests failing on CrOS. crbug.com/351114 |
25 @test.Disabled('android', 'chromeos') | 25 @test.Disabled('chromeos') |
26 def BenchmarkSmokeTest(self): | 26 def BenchmarkSmokeTest(self): |
27 # Only measure a single page so that this test cycles reasonably quickly. | 27 # Only measure a single page so that this test cycles reasonably quickly. |
28 benchmark.options['pageset_repeat'] = 1 | 28 benchmark.options['pageset_repeat'] = 1 |
29 benchmark.options['page_repeat'] = 1 | 29 benchmark.options['page_repeat'] = 1 |
30 | 30 |
31 class SinglePageBenchmark(benchmark): # pylint: disable=W0232 | 31 class SinglePageBenchmark(benchmark): # pylint: disable=W0232 |
32 def CreatePageSet(self, options): | 32 def CreatePageSet(self, options): |
33 # pylint: disable=E1002 | 33 # pylint: disable=E1002 |
34 ps = super(SinglePageBenchmark, self).CreatePageSet(options) | 34 ps = super(SinglePageBenchmark, self).CreatePageSet(options) |
35 ps.pages = ps.pages[:1] | 35 ps.pages = ps.pages[:1] |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 if hasattr(benchmark, 'generated_profile_archive'): | 77 if hasattr(benchmark, 'generated_profile_archive'): |
78 # We'd like to test these, but don't know how yet. | 78 # We'd like to test these, but don't know how yet. |
79 continue | 79 continue |
80 | 80 |
81 class BenchmarkSmokeTest(unittest.TestCase): | 81 class BenchmarkSmokeTest(unittest.TestCase): |
82 pass | 82 pass |
83 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark)) | 83 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark)) |
84 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) | 84 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) |
85 | 85 |
86 return suite | 86 return suite |
OLD | NEW |