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

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: Fixed nits. 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 option_parser.add_option( 265 option_parser.add_option(
266 '--test-apk', dest='test_apk', 266 '--test-apk', dest='test_apk',
267 help=('The name of the apk containing the tests ' 267 help=('The name of the apk containing the tests '
268 '(without the .apk extension; e.g. "ContentShellTest").')) 268 '(without the .apk extension; e.g. "ContentShellTest").'))
269 option_parser.add_option('--coverage-dir', 269 option_parser.add_option('--coverage-dir',
270 help=('Directory in which to place all generated ' 270 help=('Directory in which to place all generated '
271 'EMMA coverage files.')) 271 'EMMA coverage files.'))
272 option_parser.add_option('--device-flags', dest='device_flags', default='', 272 option_parser.add_option('--device-flags', dest='device_flags', default='',
273 help='The relative filepath to a file containing ' 273 help='The relative filepath to a file containing '
274 'command-line flags to set on the device') 274 'command-line flags to set on the device')
275 option_parser.add_option('--isolate_file_path',
276 '--isolate-file-path',
277 dest='isolate_file_path',
278 help='.isolate file path to override the default '
279 'path')
275 280
276 281
277 def ProcessInstrumentationOptions(options, error_func): 282 def ProcessInstrumentationOptions(options, error_func):
278 """Processes options/arguments and populate |options| with defaults. 283 """Processes options/arguments and populate |options| with defaults.
279 284
280 Args: 285 Args:
281 options: optparse.Options object. 286 options: optparse.Options object.
282 error_func: Function to call with the error message in case of an error. 287 error_func: Function to call with the error message in case of an error.
283 288
284 Returns: 289 Returns:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 options.test_data, 332 options.test_data,
328 options.save_perf_json, 333 options.save_perf_json,
329 options.screenshot_failures, 334 options.screenshot_failures,
330 options.wait_for_debugger, 335 options.wait_for_debugger,
331 options.coverage_dir, 336 options.coverage_dir,
332 options.test_apk, 337 options.test_apk,
333 options.test_apk_path, 338 options.test_apk_path,
334 options.test_apk_jar_path, 339 options.test_apk_jar_path,
335 options.test_runner, 340 options.test_runner,
336 options.test_support_apk_path, 341 options.test_support_apk_path,
337 options.device_flags 342 options.device_flags,
343 options.isolate_file_path
338 ) 344 )
339 345
340 346
341 def AddUIAutomatorTestOptions(option_parser): 347 def AddUIAutomatorTestOptions(option_parser):
342 """Adds UI Automator test options to |option_parser|.""" 348 """Adds UI Automator test options to |option_parser|."""
343 349
344 option_parser.usage = '%prog uiautomator [options]' 350 option_parser.usage = '%prog uiautomator [options]'
345 option_parser.commands_dict = {} 351 option_parser.commands_dict = {}
346 option_parser.example = ( 352 option_parser.example = (
347 '%prog uiautomator --test-jar=chrome_shell_uiautomator_tests' 353 '%prog uiautomator --test-jar=chrome_shell_uiautomator_tests'
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 instrumentation_options = ProcessInstrumentationOptions(options, error_func) 656 instrumentation_options = ProcessInstrumentationOptions(options, error_func)
651 657
652 if len(devices) > 1 and options.wait_for_debugger: 658 if len(devices) > 1 and options.wait_for_debugger:
653 logging.warning('Debugger can not be sharded, using first available device') 659 logging.warning('Debugger can not be sharded, using first available device')
654 devices = devices[:1] 660 devices = devices[:1]
655 661
656 results = base_test_result.TestRunResults() 662 results = base_test_result.TestRunResults()
657 exit_code = 0 663 exit_code = 0
658 664
659 if options.run_java_tests: 665 if options.run_java_tests:
660 runner_factory, tests = instrumentation_setup.Setup(instrumentation_options) 666 runner_factory, tests = instrumentation_setup.Setup(
667 instrumentation_options, devices)
661 668
662 test_results, exit_code = test_dispatcher.RunTests( 669 test_results, exit_code = test_dispatcher.RunTests(
663 tests, runner_factory, devices, shard=True, test_timeout=None, 670 tests, runner_factory, devices, shard=True, test_timeout=None,
664 num_retries=options.num_retries) 671 num_retries=options.num_retries)
665 672
666 results.AddTestRunResults(test_results) 673 results.AddTestRunResults(test_results)
667 674
668 if options.run_python_tests: 675 if options.run_python_tests:
669 runner_factory, tests = host_driven_setup.InstrumentationSetup( 676 runner_factory, tests = host_driven_setup.InstrumentationSetup(
670 options.host_driven_root, options.official_build, 677 options.host_driven_root, options.official_build,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 993
987 def main(): 994 def main():
988 signal.signal(signal.SIGUSR1, DumpThreadStacks) 995 signal.signal(signal.SIGUSR1, DumpThreadStacks)
989 option_parser = command_option_parser.CommandOptionParser( 996 option_parser = command_option_parser.CommandOptionParser(
990 commands_dict=VALID_COMMANDS) 997 commands_dict=VALID_COMMANDS)
991 return command_option_parser.ParseAndExecute(option_parser) 998 return command_option_parser.ParseAndExecute(option_parser)
992 999
993 1000
994 if __name__ == '__main__': 1001 if __name__ == '__main__':
995 sys.exit(main()) 1002 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698