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 | 19 import devil_chromium |
20 from devil import base_error | 20 from devil import base_error |
21 from devil import devil_env | |
22 from devil.android import device_blacklist | 21 from devil.android import device_blacklist |
23 from devil.android import device_errors | 22 from devil.android import device_errors |
24 from devil.android import device_utils | 23 from devil.android import device_utils |
25 from devil.android import forwarder | 24 from devil.android import forwarder |
26 from devil.android import ports | 25 from devil.android import ports |
27 from devil.utils import reraiser_thread | 26 from devil.utils import reraiser_thread |
28 from devil.utils import run_tests_helper | 27 from devil.utils import run_tests_helper |
29 | 28 |
30 from pylib import constants | 29 from pylib import constants |
31 from pylib.base import base_test_result | 30 from pylib.base import base_test_result |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 132 |
134 def ProcessCommonOptions(args): | 133 def ProcessCommonOptions(args): |
135 """Processes and handles all common options.""" | 134 """Processes and handles all common options.""" |
136 run_tests_helper.SetLogLevel(args.verbose_count) | 135 run_tests_helper.SetLogLevel(args.verbose_count) |
137 constants.SetBuildType(args.build_type) | 136 constants.SetBuildType(args.build_type) |
138 if args.build_directory: | 137 if args.build_directory: |
139 constants.SetBuildDirectory(args.build_directory) | 138 constants.SetBuildDirectory(args.build_directory) |
140 if args.output_directory: | 139 if args.output_directory: |
141 constants.SetOutputDirectory(args.output_directory) | 140 constants.SetOutputDirectory(args.output_directory) |
142 | 141 |
143 devil_custom_deps = None | |
144 if args.adb_path: | |
145 devil_custom_deps = { | |
146 'adb': { | |
147 devil_env.GetPlatform(): [args.adb_path] | |
148 } | |
149 } | |
150 | |
151 devil_chromium.Initialize( | 142 devil_chromium.Initialize( |
152 output_directory=constants.GetOutDirectory(), | 143 output_directory=constants.GetOutDirectory(), |
153 custom_deps=devil_custom_deps) | 144 adb_path=args.adb_path) |
154 | 145 |
155 # Some things such as Forwarder require ADB to be in the environment path. | 146 # Some things such as Forwarder require ADB to be in the environment path. |
156 adb_dir = os.path.dirname(constants.GetAdbPath()) | 147 adb_dir = os.path.dirname(constants.GetAdbPath()) |
157 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): | 148 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): |
158 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] | 149 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] |
159 | 150 |
160 | 151 |
161 def AddRemoteDeviceOptions(parser): | 152 def AddRemoteDeviceOptions(parser): |
162 group = parser.add_argument_group('Remote Device Options') | 153 group = parser.add_argument_group('Remote Device Options') |
163 | 154 |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 if e.is_infra_error: | 977 if e.is_infra_error: |
987 return constants.INFRA_EXIT_CODE | 978 return constants.INFRA_EXIT_CODE |
988 return constants.ERROR_EXIT_CODE | 979 return constants.ERROR_EXIT_CODE |
989 except: # pylint: disable=W0702 | 980 except: # pylint: disable=W0702 |
990 logging.exception('Unrecognized error occurred.') | 981 logging.exception('Unrecognized error occurred.') |
991 return constants.ERROR_EXIT_CODE | 982 return constants.ERROR_EXIT_CODE |
992 | 983 |
993 | 984 |
994 if __name__ == '__main__': | 985 if __name__ == '__main__': |
995 sys.exit(main()) | 986 sys.exit(main()) |
OLD | NEW |