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

Side by Side Diff: build/android/test_runner.py

Issue 689293002: Add option to push files to device using isolate for instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs all types of tests from one unified interface.""" 7 """Runs all types of tests from one unified interface."""
8 8
9 import collections 9 import collections
10 import logging 10 import logging
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 option_parser.add_option( 258 option_parser.add_option(
259 '--test-apk', dest='test_apk', 259 '--test-apk', dest='test_apk',
260 help=('The name of the apk containing the tests ' 260 help=('The name of the apk containing the tests '
261 '(without the .apk extension; e.g. "ContentShellTest").')) 261 '(without the .apk extension; e.g. "ContentShellTest").'))
262 option_parser.add_option('--coverage-dir', 262 option_parser.add_option('--coverage-dir',
263 help=('Directory in which to place all generated ' 263 help=('Directory in which to place all generated '
264 'EMMA coverage files.')) 264 'EMMA coverage files.'))
265 option_parser.add_option('--device-flags', dest='device_flags', default='', 265 option_parser.add_option('--device-flags', dest='device_flags', default='',
266 help='The relative filepath to a file containing ' 266 help='The relative filepath to a file containing '
267 'command-line flags to set on the device') 267 'command-line flags to set on the device')
268 option_parser.add_option('--isolate_file_path',
269 '--isolate-file-path',
270 dest='isolate_file_path',
271 help='.isolate file path to override the default '
272 'path')
268 273
269 274
270 def ProcessInstrumentationOptions(options, error_func): 275 def ProcessInstrumentationOptions(options, error_func):
271 """Processes options/arguments and populate |options| with defaults. 276 """Processes options/arguments and populate |options| with defaults.
272 277
273 Args: 278 Args:
274 options: optparse.Options object. 279 options: optparse.Options object.
275 error_func: Function to call with the error message in case of an error. 280 error_func: Function to call with the error message in case of an error.
276 281
277 Returns: 282 Returns:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 options.test_data, 325 options.test_data,
321 options.save_perf_json, 326 options.save_perf_json,
322 options.screenshot_failures, 327 options.screenshot_failures,
323 options.wait_for_debugger, 328 options.wait_for_debugger,
324 options.coverage_dir, 329 options.coverage_dir,
325 options.test_apk, 330 options.test_apk,
326 options.test_apk_path, 331 options.test_apk_path,
327 options.test_apk_jar_path, 332 options.test_apk_jar_path,
328 options.test_runner, 333 options.test_runner,
329 options.test_support_apk_path, 334 options.test_support_apk_path,
330 options.device_flags 335 options.device_flags,
336 options.isolate_file_path
331 ) 337 )
332 338
333 339
334 def AddUIAutomatorTestOptions(option_parser): 340 def AddUIAutomatorTestOptions(option_parser):
335 """Adds UI Automator test options to |option_parser|.""" 341 """Adds UI Automator test options to |option_parser|."""
336 342
337 option_parser.usage = '%prog uiautomator [options]' 343 option_parser.usage = '%prog uiautomator [options]'
338 option_parser.commands_dict = {} 344 option_parser.commands_dict = {}
339 option_parser.example = ( 345 option_parser.example = (
340 '%prog uiautomator --test-jar=chrome_shell_uiautomator_tests' 346 '%prog uiautomator --test-jar=chrome_shell_uiautomator_tests'
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 instrumentation_options = ProcessInstrumentationOptions(options, error_func) 649 instrumentation_options = ProcessInstrumentationOptions(options, error_func)
644 650
645 if len(devices) > 1 and options.wait_for_debugger: 651 if len(devices) > 1 and options.wait_for_debugger:
646 logging.warning('Debugger can not be sharded, using first available device') 652 logging.warning('Debugger can not be sharded, using first available device')
647 devices = devices[:1] 653 devices = devices[:1]
648 654
649 results = base_test_result.TestRunResults() 655 results = base_test_result.TestRunResults()
650 exit_code = 0 656 exit_code = 0
651 657
652 if options.run_java_tests: 658 if options.run_java_tests:
653 runner_factory, tests = instrumentation_setup.Setup(instrumentation_options) 659 runner_factory, tests = instrumentation_setup.Setup(
660 instrumentation_options, devices)
654 661
655 test_results, exit_code = test_dispatcher.RunTests( 662 test_results, exit_code = test_dispatcher.RunTests(
656 tests, runner_factory, devices, shard=True, test_timeout=None, 663 tests, runner_factory, devices, shard=True, test_timeout=None,
657 num_retries=options.num_retries) 664 num_retries=options.num_retries)
658 665
659 results.AddTestRunResults(test_results) 666 results.AddTestRunResults(test_results)
660 667
661 if options.run_python_tests: 668 if options.run_python_tests:
662 runner_factory, tests = host_driven_setup.InstrumentationSetup( 669 runner_factory, tests = host_driven_setup.InstrumentationSetup(
663 options.host_driven_root, options.official_build, 670 options.host_driven_root, options.official_build,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 986
980 def main(): 987 def main():
981 signal.signal(signal.SIGUSR1, DumpThreadStacks) 988 signal.signal(signal.SIGUSR1, DumpThreadStacks)
982 option_parser = command_option_parser.CommandOptionParser( 989 option_parser = command_option_parser.CommandOptionParser(
983 commands_dict=VALID_COMMANDS) 990 commands_dict=VALID_COMMANDS)
984 return command_option_parser.ParseAndExecute(option_parser) 991 return command_option_parser.ParseAndExecute(option_parser)
985 992
986 993
987 if __name__ == '__main__': 994 if __name__ == '__main__':
988 sys.exit(main()) 995 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698