Chromium Code Reviews| 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 logging | 11 import logging |
| 12 import os | 12 import os |
| 13 import signal | 13 import signal |
| 14 import sys | 14 import sys |
| 15 import threading | 15 import threading |
| 16 import unittest | 16 import unittest |
| 17 | 17 |
| 18 from devil import base_error | 18 from devil import base_error |
| 19 from devil.android import apk_helper | 19 from devil.android import apk_helper |
| 20 from devil.android import device_blacklist | 20 from devil.android import device_blacklist |
| 21 from devil.android import device_errors | 21 from devil.android import device_errors |
| 22 from devil.android import device_utils | 22 from devil.android import device_utils |
| 23 from devil.android import ports | 23 from devil.android import ports |
| 24 import devil.env | |
| 24 from devil.utils import reraiser_thread | 25 from devil.utils import reraiser_thread |
| 25 from devil.utils import run_tests_helper | 26 from devil.utils import run_tests_helper |
| 26 | 27 |
| 27 from pylib import constants | 28 from pylib import constants |
| 28 from pylib import forwarder | 29 from pylib import forwarder |
| 29 from pylib.base import base_test_result | 30 from pylib.base import base_test_result |
| 30 from pylib.base import environment_factory | 31 from pylib.base import environment_factory |
| 31 from pylib.base import test_dispatcher | 32 from pylib.base import test_dispatcher |
| 32 from pylib.base import test_instance_factory | 33 from pylib.base import test_instance_factory |
| 33 from pylib.base import test_run_factory | 34 from pylib.base import test_run_factory |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 def ProcessCommonOptions(args): | 111 def ProcessCommonOptions(args): |
| 111 """Processes and handles all common options.""" | 112 """Processes and handles all common options.""" |
| 112 run_tests_helper.SetLogLevel(args.verbose_count) | 113 run_tests_helper.SetLogLevel(args.verbose_count) |
| 113 constants.SetBuildType(args.build_type) | 114 constants.SetBuildType(args.build_type) |
| 114 if args.build_directory: | 115 if args.build_directory: |
| 115 constants.SetBuildDirectory(args.build_directory) | 116 constants.SetBuildDirectory(args.build_directory) |
| 116 if args.output_directory: | 117 if args.output_directory: |
| 117 constants.SetOutputDirectory(args.output_directory) | 118 constants.SetOutputDirectory(args.output_directory) |
| 118 if args.adb_path: | 119 if args.adb_path: |
| 119 constants.SetAdbPath(args.adb_path) | 120 constants.SetAdbPath(args.adb_path) |
| 121 | |
| 122 devil.env.android_sdk = devil.env.android_sdk_config.AndroidSdkConfig( | |
|
jbudorick
2015/09/09 23:47:07
Configuring devil's environment is intentionally u
perezju
2015/09/10 09:45:48
Throwing some ideas: If the intention is that conf
| |
| 123 root_path=constants.ANDROID_SDK_ROOT, | |
| 124 adb_path=args.adb_path) | |
| 125 devil.env.binaries = devil.env.binary_config.BinaryConfig( | |
| 126 binary_dir=constants.GetOutDirectory()) | |
| 127 | |
| 120 # Some things such as Forwarder require ADB to be in the environment path. | 128 # Some things such as Forwarder require ADB to be in the environment path. |
| 121 adb_dir = os.path.dirname(constants.GetAdbPath()) | 129 adb_dir = os.path.dirname(constants.GetAdbPath()) |
| 122 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): | 130 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): |
| 123 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] | 131 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] |
| 124 | 132 |
| 125 | 133 |
| 126 def AddRemoteDeviceOptions(parser): | 134 def AddRemoteDeviceOptions(parser): |
| 127 group = parser.add_argument_group('Remote Device Options') | 135 group = parser.add_argument_group('Remote Device Options') |
| 128 | 136 |
| 129 group.add_argument('--trigger', | 137 group.add_argument('--trigger', |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1065 if e.is_infra_error: | 1073 if e.is_infra_error: |
| 1066 return constants.INFRA_EXIT_CODE | 1074 return constants.INFRA_EXIT_CODE |
| 1067 return constants.ERROR_EXIT_CODE | 1075 return constants.ERROR_EXIT_CODE |
| 1068 except: # pylint: disable=W0702 | 1076 except: # pylint: disable=W0702 |
| 1069 logging.exception('Unrecognized error occurred.') | 1077 logging.exception('Unrecognized error occurred.') |
| 1070 return constants.ERROR_EXIT_CODE | 1078 return constants.ERROR_EXIT_CODE |
| 1071 | 1079 |
| 1072 | 1080 |
| 1073 if __name__ == '__main__': | 1081 if __name__ == '__main__': |
| 1074 sys.exit(main()) | 1082 sys.exit(main()) |
| OLD | NEW |