| 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 | 6 |
| 7 import os | 7 import os |
| 8 import subprocess | 8 import subprocess |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 ANDROID_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT, | 78 ANDROID_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT, |
| 79 'third_party/android_tools/sdk') | 79 'third_party/android_tools/sdk') |
| 80 ANDROID_NDK_ROOT = os.path.join(DIR_SOURCE_ROOT, | 80 ANDROID_NDK_ROOT = os.path.join(DIR_SOURCE_ROOT, |
| 81 'third_party/android_tools/ndk') | 81 'third_party/android_tools/ndk') |
| 82 | 82 |
| 83 UPSTREAM_FLAKINESS_SERVER = 'test-results.appspot.com' | 83 UPSTREAM_FLAKINESS_SERVER = 'test-results.appspot.com' |
| 84 | 84 |
| 85 | 85 |
| 86 def GetBuildType(): | 86 def GetBuildType(): |
| 87 try: | 87 try: |
| 88 return os.environ['CHROMIUM_BUILD_TYPE'] | 88 return os.environ['BUILDTYPE'] |
| 89 except KeyError: | 89 except KeyError: |
| 90 raise Exception('The build type has not been set') | 90 raise Exception('The BUILDTYPE environment variable has not been set') |
| 91 | 91 |
| 92 | 92 |
| 93 def SetBuildType(build_type): | 93 def SetBuildType(build_type): |
| 94 os.environ['CHROMIUM_BUILD_TYPE'] = build_type | 94 os.environ['BUILDTYPE'] = build_type |
| 95 | 95 |
| 96 | 96 |
| 97 def _GetADBPath(): | 97 def _GetADBPath(): |
| 98 if os.environ.get('ANDROID_SDK_ROOT'): | 98 if os.environ.get('ANDROID_SDK_ROOT'): |
| 99 return 'adb' | 99 return 'adb' |
| 100 # If envsetup.sh hasn't been sourced and there's no adb in the path, | 100 # If envsetup.sh hasn't been sourced and there's no adb in the path, |
| 101 # set it here. | 101 # set it here. |
| 102 try: | 102 try: |
| 103 with file(os.devnull, 'w') as devnull: | 103 with file(os.devnull, 'w') as devnull: |
| 104 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 104 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
| 105 return 'adb' | 105 return 'adb' |
| 106 except OSError: | 106 except OSError: |
| 107 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' | 107 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' |
| 108 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 108 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
| 109 | 109 |
| 110 | 110 |
| 111 ADB_PATH = _GetADBPath() | 111 ADB_PATH = _GetADBPath() |
| 112 | 112 |
| 113 # Exit codes | 113 # Exit codes |
| 114 ERROR_EXIT_CODE = 1 | 114 ERROR_EXIT_CODE = 1 |
| 115 WARNING_EXIT_CODE = 88 | 115 WARNING_EXIT_CODE = 88 |
| OLD | NEW |