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

Side by Side Diff: tools/telemetry/telemetry/testing/run_tests.py

Issue 1280903003: Add dependency_manager initialization to binary_manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix run_tests on win Created 5 years, 4 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
« no previous file with comments | « tools/telemetry/telemetry/internal/util/binary_manager_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 2012 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 import sys 4 import sys
5 5
6 from telemetry.core import util 6 from telemetry.core import util
7 from telemetry import decorators 7 from telemetry import decorators
8 from telemetry.internal.browser import browser_finder 8 from telemetry.internal.browser import browser_finder
9 from telemetry.internal.browser import browser_finder_exceptions 9 from telemetry.internal.browser import browser_finder_exceptions
10 from telemetry.internal.browser import browser_options 10 from telemetry.internal.browser import browser_options
11 from telemetry.internal.platform import device_finder 11 from telemetry.internal.platform import device_finder
12 from telemetry.internal.util import binary_manager
12 from telemetry.internal.util import command_line 13 from telemetry.internal.util import command_line
13 from telemetry.testing import browser_test_case 14 from telemetry.testing import browser_test_case
14 from telemetry.testing import options_for_unittests 15 from telemetry.testing import options_for_unittests
15 16
16 util.AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'typ') 17 util.AddDirToPythonPath(util.GetTelemetryThirdPartyDir(), 'typ')
17 18
18 import typ 19 import typ
19 20
20 21
21 class RunTestsCommand(command_line.OptparseCommand): 22 class RunTestsCommand(command_line.OptparseCommand):
(...skipping 16 matching lines...) Expand all
38 def AddCommandLineArgs(cls, parser, _): 39 def AddCommandLineArgs(cls, parser, _):
39 parser.add_option('--repeat-count', type='int', default=1, 40 parser.add_option('--repeat-count', type='int', default=1,
40 help='Repeats each a provided number of times.') 41 help='Repeats each a provided number of times.')
41 parser.add_option('-d', '--also-run-disabled-tests', 42 parser.add_option('-d', '--also-run-disabled-tests',
42 dest='run_disabled_tests', 43 dest='run_disabled_tests',
43 action='store_true', default=False, 44 action='store_true', default=False,
44 help='Ignore @Disabled and @Enabled restrictions.') 45 help='Ignore @Disabled and @Enabled restrictions.')
45 parser.add_option('--exact-test-filter', action='store_true', default=False, 46 parser.add_option('--exact-test-filter', action='store_true', default=False,
46 help='Treat test filter as exact matches (default is ' 47 help='Treat test filter as exact matches (default is '
47 'substring matches).') 48 'substring matches).')
49 parser.add_option('--client-config', dest='client_config', default=None)
48 50
49 typ.ArgumentParser.add_option_group(parser, 51 typ.ArgumentParser.add_option_group(parser,
50 "Options for running the tests", 52 "Options for running the tests",
51 running=True, 53 running=True,
52 skip=['-d', '-v', '--verbose']) 54 skip=['-d', '-v', '--verbose'])
53 typ.ArgumentParser.add_option_group(parser, 55 typ.ArgumentParser.add_option_group(parser,
54 "Options for reporting the results", 56 "Options for reporting the results",
55 reporting=True) 57 reporting=True)
56 58
57 @classmethod 59 @classmethod
58 def ProcessCommandLineArgs(cls, parser, args, _): 60 def ProcessCommandLineArgs(cls, parser, args, _):
59 # We retry failures by default unless we're running a list of tests 61 # We retry failures by default unless we're running a list of tests
60 # explicitly. 62 # explicitly.
61 if not args.retry_limit and not args.positional_args: 63 if not args.retry_limit and not args.positional_args:
62 args.retry_limit = 3 64 args.retry_limit = 3
63 65
66 binary_manager.InitDependencyManager(args.client_config)
nednguyen 2015/08/13 22:20:45 I think it's better to put this in the Run(self, a
aiolos (Not reviewing) 2015/08/13 22:28:32 We can only do this if we move the check for possi
67
64 try: 68 try:
65 possible_browser = browser_finder.FindBrowser(args) 69 possible_browser = browser_finder.FindBrowser(args)
66 except browser_finder_exceptions.BrowserFinderException, ex: 70 except browser_finder_exceptions.BrowserFinderException, ex:
67 parser.error(ex) 71 parser.error(ex)
68 72
69 if not possible_browser: 73 if not possible_browser:
70 parser.error('No browser found of type %s. Cannot run tests.\n' 74 parser.error('No browser found of type %s. Cannot run tests.\n'
71 'Re-run with --browser=list to see ' 75 'Re-run with --browser=list to see '
72 'available browser types.' % args.browser_type) 76 'available browser types.' % args.browser_type)
73 77
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 164
161 def _MatchesSelectedTest(name, selected_tests, selected_tests_are_exact): 165 def _MatchesSelectedTest(name, selected_tests, selected_tests_are_exact):
162 if not selected_tests: 166 if not selected_tests:
163 return False 167 return False
164 if selected_tests_are_exact: 168 if selected_tests_are_exact:
165 return any(name in selected_tests) 169 return any(name in selected_tests)
166 else: 170 else:
167 return any(test in name for test in selected_tests) 171 return any(test in name for test in selected_tests)
168 172
169 173
170 def _SetUpProcess(child, context): # pylint: disable=W0613 174 def _SetUpProcess(child, context): # pylint: disable=W0613
nednguyen 2015/08/13 22:20:45 Nit: add comment explaining why we need to init th
aiolos (Not reviewing) 2015/08/13 22:28:32 Acknowledged.
175 if binary_manager.NeedsInit():
176 binary_manager.InitDependencyManager(context.client_config)
177
171 args = context 178 args = context
172 if args.device and args.device == 'android': 179 if args.device and args.device == 'android':
173 android_devices = device_finder.GetDevicesMatchingOptions(args) 180 android_devices = device_finder.GetDevicesMatchingOptions(args)
174 args.device = android_devices[child.worker_num-1].guid 181 args.device = android_devices[child.worker_num-1].guid
175 options_for_unittests.Push(args) 182 options_for_unittests.Push(args)
176 183
177 184
178 def _TearDownProcess(child, context): # pylint: disable=W0613 185 def _TearDownProcess(child, context): # pylint: disable=W0613
179 browser_test_case.teardown_browser() 186 browser_test_case.teardown_browser()
180 options_for_unittests.Pop() 187 options_for_unittests.Pop()
181 188
182 189
183 if __name__ == '__main__': 190 if __name__ == '__main__':
184 ret_code = RunTestsCommand.main() 191 ret_code = RunTestsCommand.main()
185 sys.exit(ret_code) 192 sys.exit(ret_code)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/internal/util/binary_manager_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698