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

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

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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 | « build/android/pylib/utils/base_error.py ('k') | build/apk_test.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26 matching lines...) Expand all
37 from pylib.monkey import setup as monkey_setup 37 from pylib.monkey import setup as monkey_setup
38 from pylib.monkey import test_options as monkey_test_options 38 from pylib.monkey import test_options as monkey_test_options
39 from pylib.perf import setup as perf_setup 39 from pylib.perf import setup as perf_setup
40 from pylib.perf import test_options as perf_test_options 40 from pylib.perf import test_options as perf_test_options
41 from pylib.perf import test_runner as perf_test_runner 41 from pylib.perf import test_runner as perf_test_runner
42 from pylib.results import json_results 42 from pylib.results import json_results
43 from pylib.results import report_results 43 from pylib.results import report_results
44 from pylib.uiautomator import setup as uiautomator_setup 44 from pylib.uiautomator import setup as uiautomator_setup
45 from pylib.uiautomator import test_options as uiautomator_test_options 45 from pylib.uiautomator import test_options as uiautomator_test_options
46 from pylib.utils import apk_helper 46 from pylib.utils import apk_helper
47 from pylib.utils import base_error
47 from pylib.utils import reraiser_thread 48 from pylib.utils import reraiser_thread
48 from pylib.utils import run_tests_helper 49 from pylib.utils import run_tests_helper
49 50
50 51
51 def AddCommonOptions(parser): 52 def AddCommonOptions(parser):
52 """Adds all common options to |parser|.""" 53 """Adds all common options to |parser|."""
53 54
54 group = parser.add_argument_group('Common Options') 55 group = parser.add_argument_group('Common Options')
55 56
56 default_build_type = os.environ.get('BUILDTYPE', 'Debug') 57 default_build_type = os.environ.get('BUILDTYPE', 'Debug')
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 results=results, 951 results=results,
951 test_type=test.TestType(), 952 test_type=test.TestType(),
952 test_package=test_run.TestPackage(), 953 test_package=test_run.TestPackage(),
953 annotation=getattr(args, 'annotations', None), 954 annotation=getattr(args, 'annotations', None),
954 flakiness_server=getattr(args, 'flakiness_dashboard_server', None)) 955 flakiness_server=getattr(args, 'flakiness_dashboard_server', None))
955 956
956 if args.json_results_file: 957 if args.json_results_file:
957 json_results.GenerateJsonResultsFile( 958 json_results.GenerateJsonResultsFile(
958 results, args.json_results_file) 959 results, args.json_results_file)
959 960
960 return 0 if results.DidRunPass() else 1 961 return 0 if results.DidRunPass() else constants.ERROR_EXIT_CODE
961 962
962 963
963 CommandConfigTuple = collections.namedtuple( 964 CommandConfigTuple = collections.namedtuple(
964 'CommandConfigTuple', 965 'CommandConfigTuple',
965 ['add_options_func', 'help_txt']) 966 ['add_options_func', 'help_txt'])
966 VALID_COMMANDS = { 967 VALID_COMMANDS = {
967 'gtest': CommandConfigTuple( 968 'gtest': CommandConfigTuple(
968 AddGTestOptions, 969 AddGTestOptions,
969 'googletest-based C++ tests'), 970 'googletest-based C++ tests'),
970 'instrumentation': CommandConfigTuple( 971 'instrumentation': CommandConfigTuple(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 command_parsers = parser.add_subparsers(title='test types', 1007 command_parsers = parser.add_subparsers(title='test types',
1007 dest='command') 1008 dest='command')
1008 1009
1009 for test_type, config in sorted(VALID_COMMANDS.iteritems(), 1010 for test_type, config in sorted(VALID_COMMANDS.iteritems(),
1010 key=lambda x: x[0]): 1011 key=lambda x: x[0]):
1011 subparser = command_parsers.add_parser( 1012 subparser = command_parsers.add_parser(
1012 test_type, usage='%(prog)s [options]', help=config.help_txt) 1013 test_type, usage='%(prog)s [options]', help=config.help_txt)
1013 config.add_options_func(subparser) 1014 config.add_options_func(subparser)
1014 1015
1015 args = parser.parse_args() 1016 args = parser.parse_args()
1016 return RunTestsCommand(args, parser) 1017
1018 try:
1019 return RunTestsCommand(args, parser)
1020 except base_error.BaseError as e:
1021 logging.exception('Error occurred.')
1022 if e.is_infra_error:
1023 return constants.INFRA_EXIT_CODE
1024 else:
1025 return constants.ERROR_EXIT_CODE
1026 except: # pylint: disable=W0702
1027 logging.exception('Unrecognized error occurred.')
1028 return constants.ERROR_EXIT_CODE
1017 1029
1018 1030
1019 if __name__ == '__main__': 1031 if __name__ == '__main__':
1020 sys.exit(main()) 1032 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/pylib/utils/base_error.py ('k') | build/apk_test.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698