OLD | NEW |
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 |
11 import itertools | 11 import itertools |
12 import logging | 12 import logging |
13 import os | 13 import os |
14 import signal | 14 import signal |
15 import sys | 15 import sys |
16 import threading | 16 import threading |
17 import unittest | 17 import unittest |
18 | 18 |
19 import devil_chromium | |
20 | |
21 from devil import base_error | 19 from devil import base_error |
22 from devil.android import apk_helper | 20 from devil.android import apk_helper |
23 from devil.android import device_blacklist | 21 from devil.android import device_blacklist |
24 from devil.android import device_errors | 22 from devil.android import device_errors |
25 from devil.android import device_utils | 23 from devil.android import device_utils |
26 from devil.android import ports | 24 from devil.android import ports |
27 from devil.utils import reraiser_thread | 25 from devil.utils import reraiser_thread |
28 from devil.utils import run_tests_helper | 26 from devil.utils import run_tests_helper |
29 | 27 |
30 from pylib import constants | 28 from pylib import constants |
(...skipping 11 matching lines...) Expand all Loading... |
42 from pylib.junit import test_dispatcher as junit_dispatcher | 40 from pylib.junit import test_dispatcher as junit_dispatcher |
43 from pylib.monkey import setup as monkey_setup | 41 from pylib.monkey import setup as monkey_setup |
44 from pylib.monkey import test_options as monkey_test_options | 42 from pylib.monkey import test_options as monkey_test_options |
45 from pylib.perf import setup as perf_setup | 43 from pylib.perf import setup as perf_setup |
46 from pylib.perf import test_options as perf_test_options | 44 from pylib.perf import test_options as perf_test_options |
47 from pylib.perf import test_runner as perf_test_runner | 45 from pylib.perf import test_runner as perf_test_runner |
48 from pylib.results import json_results | 46 from pylib.results import json_results |
49 from pylib.results import report_results | 47 from pylib.results import report_results |
50 | 48 |
51 | 49 |
52 _DEVIL_STATIC_CONFIG_FILE = os.path.abspath(os.path.join( | |
53 constants.DIR_SOURCE_ROOT, 'build', 'android', 'devil_config.json')) | |
54 | |
55 | |
56 def AddCommonOptions(parser): | 50 def AddCommonOptions(parser): |
57 """Adds all common options to |parser|.""" | 51 """Adds all common options to |parser|.""" |
58 | 52 |
59 group = parser.add_argument_group('Common Options') | 53 group = parser.add_argument_group('Common Options') |
60 | 54 |
61 default_build_type = os.environ.get('BUILDTYPE', 'Debug') | 55 default_build_type = os.environ.get('BUILDTYPE', 'Debug') |
62 | 56 |
63 debug_or_release_group = group.add_mutually_exclusive_group() | 57 debug_or_release_group = group.add_mutually_exclusive_group() |
64 debug_or_release_group.add_argument( | 58 debug_or_release_group.add_argument( |
65 '--debug', action='store_const', const='Debug', dest='build_type', | 59 '--debug', action='store_const', const='Debug', dest='build_type', |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 'to specified file.') | 104 'to specified file.') |
111 | 105 |
112 def ProcessCommonOptions(args): | 106 def ProcessCommonOptions(args): |
113 """Processes and handles all common options.""" | 107 """Processes and handles all common options.""" |
114 run_tests_helper.SetLogLevel(args.verbose_count) | 108 run_tests_helper.SetLogLevel(args.verbose_count) |
115 constants.SetBuildType(args.build_type) | 109 constants.SetBuildType(args.build_type) |
116 if args.build_directory: | 110 if args.build_directory: |
117 constants.SetBuildDirectory(args.build_directory) | 111 constants.SetBuildDirectory(args.build_directory) |
118 if args.output_directory: | 112 if args.output_directory: |
119 constants.SetOutputDirectory(args.output_directory) | 113 constants.SetOutputDirectory(args.output_directory) |
120 | |
121 devil_custom_deps = None | |
122 if args.adb_path: | 114 if args.adb_path: |
123 devil_custom_deps = { | 115 constants.SetAdbPath(args.adb_path) |
124 'adb': { | |
125 'android_host': [args.adb_path] | |
126 } | |
127 } | |
128 | |
129 devil_chromium.Initialize( | |
130 output_directory=constants.GetOutDirectory(), | |
131 custom_deps=devil_custom_deps) | |
132 | |
133 # Some things such as Forwarder require ADB to be in the environment path. | 116 # Some things such as Forwarder require ADB to be in the environment path. |
134 adb_dir = os.path.dirname(constants.GetAdbPath()) | 117 adb_dir = os.path.dirname(constants.GetAdbPath()) |
135 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): | 118 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): |
136 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] | 119 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] |
137 | 120 |
138 | 121 |
139 def AddRemoteDeviceOptions(parser): | 122 def AddRemoteDeviceOptions(parser): |
140 group = parser.add_argument_group('Remote Device Options') | 123 group = parser.add_argument_group('Remote Device Options') |
141 | 124 |
142 group.add_argument('--trigger', | 125 group.add_argument('--trigger', |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 if e.is_infra_error: | 1022 if e.is_infra_error: |
1040 return constants.INFRA_EXIT_CODE | 1023 return constants.INFRA_EXIT_CODE |
1041 return constants.ERROR_EXIT_CODE | 1024 return constants.ERROR_EXIT_CODE |
1042 except: # pylint: disable=W0702 | 1025 except: # pylint: disable=W0702 |
1043 logging.exception('Unrecognized error occurred.') | 1026 logging.exception('Unrecognized error occurred.') |
1044 return constants.ERROR_EXIT_CODE | 1027 return constants.ERROR_EXIT_CODE |
1045 | 1028 |
1046 | 1029 |
1047 if __name__ == '__main__': | 1030 if __name__ == '__main__': |
1048 sys.exit(main()) | 1031 sys.exit(main()) |
OLD | NEW |