OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Defines a set of constants shared by test runners and other scripts.""" | 5 """Defines a set of constants shared by test runners and other scripts.""" |
6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
7 | 7 |
8 import collections | 8 import collections |
9 import logging | 9 import logging |
10 import os | 10 import os |
11 import subprocess | 11 import subprocess |
12 | 12 |
13 | 13 |
14 DIR_SOURCE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), | 14 DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT', |
15 os.pardir, os.pardir, os.pardir)) | 15 os.path.abspath(os.path.join(os.path.dirname(__file__), |
| 16 os.pardir, os.pardir, os.pardir))) |
16 ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir') | 17 ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir') |
17 | 18 |
18 CHROME_SHELL_HOST_DRIVEN_DIR = os.path.join( | 19 CHROME_SHELL_HOST_DRIVEN_DIR = os.path.join( |
19 DIR_SOURCE_ROOT, 'chrome', 'android') | 20 DIR_SOURCE_ROOT, 'chrome', 'android') |
20 | 21 |
21 | 22 |
22 PackageInfo = collections.namedtuple('PackageInfo', | 23 PackageInfo = collections.namedtuple('PackageInfo', |
23 ['package', 'activity', 'cmdline_file', 'devtools_socket', | 24 ['package', 'activity', 'cmdline_file', 'devtools_socket', |
24 'test_package']) | 25 'test_package']) |
25 | 26 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 def GetBuildType(): | 164 def GetBuildType(): |
164 try: | 165 try: |
165 return os.environ['BUILDTYPE'] | 166 return os.environ['BUILDTYPE'] |
166 except KeyError: | 167 except KeyError: |
167 raise Exception('The BUILDTYPE environment variable has not been set') | 168 raise Exception('The BUILDTYPE environment variable has not been set') |
168 | 169 |
169 | 170 |
170 def SetBuildType(build_type): | 171 def SetBuildType(build_type): |
171 os.environ['BUILDTYPE'] = build_type | 172 os.environ['BUILDTYPE'] = build_type |
172 | 173 |
173 | |
174 def GetOutDirectory(build_type=None): | 174 def GetOutDirectory(build_type=None): |
175 """Returns the out directory where the output binaries are built. | 175 """Returns the out directory where the output binaries are built. |
176 | 176 |
177 Args: | 177 Args: |
178 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the | 178 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the |
179 globally set build type environment variable BUILDTYPE. | 179 globally set build type environment variable BUILDTYPE. |
180 """ | 180 """ |
181 return os.path.abspath(os.path.join( | 181 return os.path.abspath(os.path.join( |
182 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'), | 182 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'), |
183 GetBuildType() if build_type is None else build_type)) | 183 GetBuildType() if build_type is None else build_type)) |
(...skipping 20 matching lines...) Expand all Loading... |
204 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 204 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
205 return 'adb' | 205 return 'adb' |
206 except OSError: | 206 except OSError: |
207 logging.debug('No adb found in $PATH, fallback to checked in binary.') | 207 logging.debug('No adb found in $PATH, fallback to checked in binary.') |
208 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 208 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
209 | 209 |
210 | 210 |
211 # Exit codes | 211 # Exit codes |
212 ERROR_EXIT_CODE = 1 | 212 ERROR_EXIT_CODE = 1 |
213 WARNING_EXIT_CODE = 88 | 213 WARNING_EXIT_CODE = 88 |
OLD | NEW |