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

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

Issue 794923003: [Android] Implement instrumentation tests in platform mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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 argparse 9 import argparse
10 import collections 10 import collections
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 java_or_python_group.add_argument( 286 java_or_python_group.add_argument(
287 '-p', '--python-only', action='store_false', 287 '-p', '--python-only', action='store_false',
288 dest='run_java_tests', default=True, 288 dest='run_java_tests', default=True,
289 help='Run only the host-driven tests.') 289 help='Run only the host-driven tests.')
290 290
291 group.add_argument('--host-driven-root', 291 group.add_argument('--host-driven-root',
292 help='Root of the host-driven tests.') 292 help='Root of the host-driven tests.')
293 group.add_argument('-w', '--wait_debugger', dest='wait_for_debugger', 293 group.add_argument('-w', '--wait_debugger', dest='wait_for_debugger',
294 action='store_true', 294 action='store_true',
295 help='Wait for debugger.') 295 help='Wait for debugger.')
296 group.add_argument('--apk-under-test', dest='apk_under_test',
297 help=('the name of the apk under test.'))
296 group.add_argument('--test-apk', dest='test_apk', required=True, 298 group.add_argument('--test-apk', dest='test_apk', required=True,
297 help=('The name of the apk containing the tests ' 299 help=('The name of the apk containing the tests '
298 '(without the .apk extension; ' 300 '(without the .apk extension; '
299 'e.g. "ContentShellTest").')) 301 'e.g. "ContentShellTest").'))
300 group.add_argument('--coverage-dir', 302 group.add_argument('--coverage-dir',
301 help=('Directory in which to place all generated ' 303 help=('Directory in which to place all generated '
302 'EMMA coverage files.')) 304 'EMMA coverage files.'))
303 group.add_argument('--device-flags', dest='device_flags', default='', 305 group.add_argument('--device-flags', dest='device_flags', default='',
304 help='The relative filepath to a file containing ' 306 help='The relative filepath to a file containing '
305 'command-line flags to set on the device') 307 'command-line flags to set on the device')
308 group.add_argument('--device-flags-file', default='',
309 help='The relative filepath to a file containing '
310 'command-line flags to set on the device')
306 group.add_argument('--isolate_file_path', 311 group.add_argument('--isolate_file_path',
307 '--isolate-file-path', 312 '--isolate-file-path',
308 dest='isolate_file_path', 313 dest='isolate_file_path',
309 help='.isolate file path to override the default ' 314 help='.isolate file path to override the default '
310 'path') 315 'path')
311 316
312 AddCommonOptions(parser) 317 AddCommonOptions(parser)
313 AddDeviceOptions(parser) 318 AddDeviceOptions(parser)
314 319
315 320
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 elif command == 'perf': 896 elif command == 'perf':
892 return _RunPerfTests(args) 897 return _RunPerfTests(args)
893 elif command == 'python': 898 elif command == 'python':
894 return _RunPythonTests(args) 899 return _RunPythonTests(args)
895 else: 900 else:
896 raise Exception('Unknown test type.') 901 raise Exception('Unknown test type.')
897 902
898 903
899 _SUPPORTED_IN_PLATFORM_MODE = [ 904 _SUPPORTED_IN_PLATFORM_MODE = [
900 # TODO(jbudorick): Add support for more test types. 905 # TODO(jbudorick): Add support for more test types.
901 'gtest', 'uirobot', 906 'gtest',
907 'instrumentation',
908 'uirobot',
902 ] 909 ]
903 910
904 911
905 def RunTestsInPlatformMode(args, parser): 912 def RunTestsInPlatformMode(args, parser):
906 913
907 if args.command not in _SUPPORTED_IN_PLATFORM_MODE: 914 if args.command not in _SUPPORTED_IN_PLATFORM_MODE:
908 parser.error('%s is not yet supported in platform mode' % args.command) 915 parser.error('%s is not yet supported in platform mode' % args.command)
909 916
910 with environment_factory.CreateEnvironment(args, parser.error) as env: 917 with environment_factory.CreateEnvironment(args, parser.error) as env:
911 with test_instance_factory.CreateTestInstance(args, parser.error) as test: 918 with test_instance_factory.CreateTestInstance(args, parser.error) as test:
912 with test_run_factory.CreateTestRun( 919 with test_run_factory.CreateTestRun(
913 args, env, test, parser.error) as test_run: 920 args, env, test, parser.error) as test_run:
914 results = test_run.RunTests() 921 results = test_run.RunTests()
915 922
916 if args.trigger: 923 if args.environment == 'remote_device' and args.trigger:
917 return 0 # Not returning results, only triggering. 924 return 0 # Not returning results, only triggering.
918 925
919 report_results.LogFull( 926 report_results.LogFull(
920 results=results, 927 results=results,
921 test_type=test.TestType(), 928 test_type=test.TestType(),
922 test_package=test_run.TestPackage(), 929 test_package=test_run.TestPackage(),
923 annotation=getattr(args, 'annotations', None), 930 annotation=getattr(args, 'annotations', None),
924 flakiness_server=getattr(args, 'flakiness_dashboard_server', None)) 931 flakiness_server=getattr(args, 'flakiness_dashboard_server', None))
925 932
926 if args.json_results_file: 933 if args.json_results_file:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 subparser = command_parsers.add_parser( 988 subparser = command_parsers.add_parser(
982 test_type, usage='%(prog)s [options]', help=config.help_txt) 989 test_type, usage='%(prog)s [options]', help=config.help_txt)
983 config.add_options_func(subparser) 990 config.add_options_func(subparser)
984 991
985 args = parser.parse_args() 992 args = parser.parse_args()
986 return RunTestsCommand(args, parser) 993 return RunTestsCommand(args, parser)
987 994
988 995
989 if __name__ == '__main__': 996 if __name__ == '__main__':
990 sys.exit(main()) 997 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/pylib/local/device/local_device_test_run.py ('k') | chrome/chrome_shell_test_apk.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698