| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 VALID_ENVIRONMENTS = ['local', 'remote_device'] | 212 VALID_ENVIRONMENTS = ['local', 'remote_device'] |
| 213 VALID_TEST_TYPES = ['gtest', 'instrumentation', 'junit', 'linker', 'monkey', | 213 VALID_TEST_TYPES = ['gtest', 'instrumentation', 'junit', 'linker', 'monkey', |
| 214 'perf', 'python', 'uiautomator', 'uirobot'] | 214 'perf', 'python', 'uiautomator', 'uirobot'] |
| 215 VALID_DEVICE_TYPES = ['Android', 'iOS'] | 215 VALID_DEVICE_TYPES = ['Android', 'iOS'] |
| 216 | 216 |
| 217 | 217 |
| 218 def GetBuildType(): | 218 def GetBuildType(): |
| 219 try: | 219 try: |
| 220 return os.environ['BUILDTYPE'] | 220 return os.environ['BUILDTYPE'] |
| 221 except KeyError: | 221 except KeyError: |
| 222 raise Exception('The BUILDTYPE environment variable has not been set') | 222 raise EnvironmentError( |
| 223 'The BUILDTYPE environment variable has not been set') |
| 223 | 224 |
| 224 | 225 |
| 225 def SetBuildType(build_type): | 226 def SetBuildType(build_type): |
| 226 os.environ['BUILDTYPE'] = build_type | 227 os.environ['BUILDTYPE'] = build_type |
| 227 | 228 |
| 228 | 229 |
| 229 def SetBuildDirectory(build_directory): | 230 def SetBuildDirectory(build_directory): |
| 230 os.environ['CHROMIUM_OUT_DIR'] = build_directory | 231 os.environ['CHROMIUM_OUT_DIR'] = build_directory |
| 231 | 232 |
| 232 | 233 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 285 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
| 285 return 'adb' | 286 return 'adb' |
| 286 except OSError: | 287 except OSError: |
| 287 logging.debug('No adb found in $PATH, fallback to checked in binary.') | 288 logging.debug('No adb found in $PATH, fallback to checked in binary.') |
| 288 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 289 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
| 289 | 290 |
| 290 # Exit codes | 291 # Exit codes |
| 291 ERROR_EXIT_CODE = 1 | 292 ERROR_EXIT_CODE = 1 |
| 292 INFRA_EXIT_CODE = 87 | 293 INFRA_EXIT_CODE = 87 |
| 293 WARNING_EXIT_CODE = 88 | 294 WARNING_EXIT_CODE = 88 |
| OLD | NEW |