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 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 DEVICE_LOCAL_PROPERTIES_PATH = '/data/local.prop' | 183 DEVICE_LOCAL_PROPERTIES_PATH = '/data/local.prop' |
184 | 184 |
185 PYTHON_UNIT_TEST_SUITES = { | 185 PYTHON_UNIT_TEST_SUITES = { |
186 'pylib_py_unittests': { | 186 'pylib_py_unittests': { |
187 'path': os.path.join(DIR_SOURCE_ROOT, 'build', 'android'), | 187 'path': os.path.join(DIR_SOURCE_ROOT, 'build', 'android'), |
188 'test_modules': [ | 188 'test_modules': [ |
189 'pylib.device.device_utils_test', | 189 'pylib.device.device_utils_test', |
190 ] | 190 ] |
191 }, | 191 }, |
192 # TODO(mkosiba) Enable after fixing these tests. | 192 'gyp_py_unittests': { |
193 # 'gyp_py_unittests': { | 193 'path': os.path.join(DIR_SOURCE_ROOT, 'build', 'android', 'gyp'), |
194 # 'path': os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', 'gyp'), | 194 'test_modules': [ |
195 # 'test_modules': [ | 195 'java_cpp_enum_tests', |
196 # 'java_cpp_enum_tests' | 196 ] |
197 # ] | 197 }, |
198 # }, | |
199 } | 198 } |
200 | 199 |
201 LOCAL_MACHINE_TESTS = ['junit', 'python'] | 200 LOCAL_MACHINE_TESTS = ['junit', 'python'] |
202 VALID_ENVIRONMENTS = ['local'] | 201 VALID_ENVIRONMENTS = ['local'] |
203 | 202 |
204 | 203 |
205 def GetBuildType(): | 204 def GetBuildType(): |
206 try: | 205 try: |
207 return os.environ['BUILDTYPE'] | 206 return os.environ['BUILDTYPE'] |
208 except KeyError: | 207 except KeyError: |
209 raise Exception('The BUILDTYPE environment variable has not been set') | 208 raise Exception('The BUILDTYPE environment variable has not been set') |
210 | 209 |
211 | 210 |
212 def SetBuildType(build_type): | 211 def SetBuildType(build_type): |
213 os.environ['BUILDTYPE'] = build_type | 212 os.environ['BUILDTYPE'] = build_type |
214 | 213 |
215 | 214 |
216 def SetBuildDirectory(build_directory): | 215 def SetBuildDirectory(build_directory): |
217 os.environ['CHROMIUM_OUT_DIR'] = build_directory | 216 os.environ['CHROMIUM_OUT_DIR'] = build_directory |
218 | 217 |
219 | 218 |
| 219 def SetOutputDirectort(output_directory): |
| 220 os.environ['CHROMIUM_OUTPUT_DIR'] = output_directory |
| 221 |
| 222 |
220 def GetOutDirectory(build_type=None): | 223 def GetOutDirectory(build_type=None): |
221 """Returns the out directory where the output binaries are built. | 224 """Returns the out directory where the output binaries are built. |
222 | 225 |
223 Args: | 226 Args: |
224 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the | 227 build_type: Build type, generally 'Debug' or 'Release'. Defaults to the |
225 globally set build type environment variable BUILDTYPE. | 228 globally set build type environment variable BUILDTYPE. |
226 """ | 229 """ |
| 230 if 'CHROMIUM_OUTPUT_DIR' in os.environ: |
| 231 return os.path.abspath(os.path.join( |
| 232 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUTPUT_DIR'))) |
| 233 |
227 return os.path.abspath(os.path.join( | 234 return os.path.abspath(os.path.join( |
228 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'), | 235 DIR_SOURCE_ROOT, os.environ.get('CHROMIUM_OUT_DIR', 'out'), |
229 GetBuildType() if build_type is None else build_type)) | 236 GetBuildType() if build_type is None else build_type)) |
230 | 237 |
231 | 238 |
232 def _Memoize(func): | 239 def _Memoize(func): |
233 def Wrapper(): | 240 def Wrapper(): |
234 try: | 241 try: |
235 return func._result | 242 return func._result |
236 except AttributeError: | 243 except AttributeError: |
(...skipping 13 matching lines...) Expand all Loading... |
250 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 257 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
251 return 'adb' | 258 return 'adb' |
252 except OSError: | 259 except OSError: |
253 logging.debug('No adb found in $PATH, fallback to checked in binary.') | 260 logging.debug('No adb found in $PATH, fallback to checked in binary.') |
254 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 261 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
255 | 262 |
256 | 263 |
257 # Exit codes | 264 # Exit codes |
258 ERROR_EXIT_CODE = 1 | 265 ERROR_EXIT_CODE = 1 |
259 WARNING_EXIT_CODE = 88 | 266 WARNING_EXIT_CODE = 88 |
OLD | NEW |