Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: trunk/src/tools/perf/benchmarks/benchmark_unittest.py

Issue 289053002: Revert 270766 "[telemetry] Make testMeasurementSmoke generate se..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/tools/perf/measurements/measurement_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 """Run the first page of every benchmark that has a composable measurement.
6
7 Ideally this test would be comprehensive, but the above serves as a
8 kind of smoke test.
9 """
10
11 import os
12 import unittest
13
14 from telemetry import test
15 from telemetry.core import discover
16 from telemetry.page import page_measurement
17 from telemetry.unittest import options_for_unittests
18
19
20 # In general you should @test.Disabled individual benchmarks that fail,
21 # instead of this entire smoke test suite.
22 # TODO(achuith): Multiple tests failing on CrOS. crbug.com/351114
23 @test.Disabled('android', 'chromeos', 'win')
24 class BenchmarkSmokeTest(unittest.TestCase):
25 """Placeholder class for the tests.
26
27 The members of this class are generated in load_tests, below.
28 """
29
30
31 def SmokeTestGenerator(benchmark):
32 def SmokeTest(self):
33 # Only measure a single page so that this test cycles reasonably quickly.
34 benchmark.options['pageset_repeat'] = 1
35 benchmark.options['page_repeat'] = 1
36
37 class SinglePageBenchmark(benchmark): # pylint: disable=W0232
38 def CreatePageSet(self, options):
39 # pylint: disable=E1002
40 ps = super(SinglePageBenchmark, self).CreatePageSet(options)
41 ps.pages = ps.pages[:1]
42 return ps
43
44 # Set the benchmark's default arguments.
45 options = options_for_unittests.GetCopy()
46 options.output_format = 'none'
47 parser = options.CreateParser()
48
49 benchmark.AddCommandLineArgs(parser)
50 test.AddCommandLineArgs(parser)
51 benchmark.SetArgumentDefaults(parser)
52 options.MergeDefaultValues(parser.get_default_values())
53
54 benchmark.ProcessCommandLineArgs(None, options)
55 test.ProcessCommandLineArgs(None, options)
56
57 self.assertEqual(0, SinglePageBenchmark().Run(options),
58 msg='Failed: %s' % benchmark)
59
60 return SmokeTest
61
62
63 def load_tests(_, _2, _3):
64 suite = unittest.TestSuite()
65
66 benchmarks_dir = os.path.dirname(__file__)
67 top_level_dir = os.path.dirname(benchmarks_dir)
68 measurements_dir = os.path.join(top_level_dir, 'measurements')
69
70 all_measurements = discover.DiscoverClasses(
71 measurements_dir, top_level_dir, page_measurement.PageMeasurement,
72 pattern='*.py').values()
73 all_benchmarks = discover.DiscoverClasses(
74 benchmarks_dir, top_level_dir, test.Test, pattern='*.py').values()
75
76 for benchmark in all_benchmarks:
77 if benchmark.PageTestClass() not in all_measurements:
78 # If the benchmark is not in measurements, then it is not composable.
79 # Ideally we'd like to test these as well, but the non-composable
80 # benchmarks are usually long-running benchmarks.
81 continue
82
83 if hasattr(benchmark, 'generated_profile_archive'):
84 # We'd like to test these, but don't know how yet.
85 continue
86
87 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark))
88 suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
89
90 return suite
OLDNEW
« no previous file with comments | « no previous file | trunk/src/tools/perf/measurements/measurement_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698