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

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

Issue 382433002: [telemetry] OutputFormatter for unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move RestoreLoggingLevel to the right place.s Created 6 years, 5 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 | « content/test/gpu/run_unittests ('k') | tools/perf/run_tests » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_measurement 16 from telemetry.page import page_measurement
17 from telemetry.unittest import gtest_unittest_results
18 from telemetry.unittest import options_for_unittests 17 from telemetry.unittest import options_for_unittests
18 from telemetry.unittest import output_formatter
19 19
20 20
21 def SmokeTestGenerator(benchmark): 21 def SmokeTestGenerator(benchmark):
22 # In general you should @benchmark_module.Disabled individual benchmarks that 22 # In general you should @benchmark_module.Disabled individual benchmarks that
23 # fail, instead of this entire smoke test suite. 23 # fail, 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 @benchmark_module.Disabled('chromeos') 25 @benchmark_module.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
(...skipping 19 matching lines...) Expand all
48 benchmark.ProcessCommandLineArgs(None, options) 48 benchmark.ProcessCommandLineArgs(None, options)
49 benchmark_module.ProcessCommandLineArgs(None, options) 49 benchmark_module.ProcessCommandLineArgs(None, options)
50 50
51 self.assertEqual(0, SinglePageBenchmark().Run(options), 51 self.assertEqual(0, SinglePageBenchmark().Run(options),
52 msg='Failed: %s' % benchmark) 52 msg='Failed: %s' % benchmark)
53 53
54 return BenchmarkSmokeTest 54 return BenchmarkSmokeTest
55 55
56 56
57 def load_tests(_, _2, _3): 57 def load_tests(_, _2, _3):
58 suite = gtest_unittest_results.GTestTestSuite() 58 suite = output_formatter.TestSuite()
59 59
60 benchmarks_dir = os.path.dirname(__file__) 60 benchmarks_dir = os.path.dirname(__file__)
61 top_level_dir = os.path.dirname(benchmarks_dir) 61 top_level_dir = os.path.dirname(benchmarks_dir)
62 measurements_dir = os.path.join(top_level_dir, 'measurements') 62 measurements_dir = os.path.join(top_level_dir, 'measurements')
63 63
64 all_measurements = discover.DiscoverClasses( 64 all_measurements = discover.DiscoverClasses(
65 measurements_dir, top_level_dir, page_measurement.PageMeasurement, 65 measurements_dir, top_level_dir, page_measurement.PageMeasurement,
66 pattern='*.py').values() 66 pattern='*.py').values()
67 all_benchmarks = discover.DiscoverClasses( 67 all_benchmarks = discover.DiscoverClasses(
68 benchmarks_dir, top_level_dir, benchmark_module.Benchmark, 68 benchmarks_dir, top_level_dir, benchmark_module.Benchmark,
(...skipping 12 matching lines...) Expand all
81 if hasattr(benchmark, 'generated_profile_archive'): 81 if hasattr(benchmark, 'generated_profile_archive'):
82 # We'd like to test these, but don't know how yet. 82 # We'd like to test these, but don't know how yet.
83 continue 83 continue
84 84
85 class BenchmarkSmokeTest(unittest.TestCase): 85 class BenchmarkSmokeTest(unittest.TestCase):
86 pass 86 pass
87 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark)) 87 setattr(BenchmarkSmokeTest, benchmark.Name(), SmokeTestGenerator(benchmark))
88 suite.addTest(BenchmarkSmokeTest(benchmark.Name())) 88 suite.addTest(BenchmarkSmokeTest(benchmark.Name()))
89 89
90 return suite 90 return suite
OLDNEW
« no previous file with comments | « content/test/gpu/run_unittests ('k') | tools/perf/run_tests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698