Chromium Code Reviews| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 | 76 |
| 77 ANDROID_SDK_VERSION = 18 | 77 ANDROID_SDK_VERSION = 18 |
| 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(): | |
|
frankf
2013/08/14 21:45:09
As discussed, what you really care about is the ou
| |
| 87 try: | |
| 88 return os.environ['CHROMIUM_BUILD_TYPE'] | |
| 89 except KeyError: | |
| 90 raise Exception('The build type has not been set') | |
| 91 | |
| 92 | |
| 93 def SetBuildType(build_type): | |
| 94 os.environ['CHROMIUM_BUILD_TYPE'] = build_type | |
| 95 | |
| 96 | |
| 86 def _GetADBPath(): | 97 def _GetADBPath(): |
| 87 if os.environ.get('ANDROID_SDK_ROOT'): | 98 if os.environ.get('ANDROID_SDK_ROOT'): |
| 88 return 'adb' | 99 return 'adb' |
| 89 # 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, |
| 90 # set it here. | 101 # set it here. |
| 91 try: | 102 try: |
| 92 with file(os.devnull, 'w') as devnull: | 103 with file(os.devnull, 'w') as devnull: |
| 93 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 104 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
| 94 return 'adb' | 105 return 'adb' |
| 95 except OSError: | 106 except OSError: |
| 96 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.' |
| 97 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 108 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
| 98 | 109 |
| 99 | 110 |
| 100 ADB_PATH = _GetADBPath() | 111 ADB_PATH = _GetADBPath() |
| 101 | 112 |
| 102 # Exit codes | 113 # Exit codes |
| 103 ERROR_EXIT_CODE = 1 | 114 ERROR_EXIT_CODE = 1 |
| 104 WARNING_EXIT_CODE = 88 | 115 WARNING_EXIT_CODE = 88 |
| OLD | NEW |