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 |
11 | 11 |
12 DIR_SOURCE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), | 12 DIR_SOURCE_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), |
13 os.pardir, os.pardir, os.pardir)) | 13 os.pardir, os.pardir, os.pardir)) |
14 ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir') | 14 ISOLATE_DEPS_DIR = os.path.join(DIR_SOURCE_ROOT, 'isolate_deps_dir') |
15 EMULATOR_SDK_ROOT = os.path.abspath(os.path.join(DIR_SOURCE_ROOT, os.pardir, | 15 EMULATOR_SDK_ROOT = os.path.abspath(os.path.join(DIR_SOURCE_ROOT, os.pardir, |
16 os.pardir)) | 16 os.pardir)) |
17 | |
18 CHROME_PACKAGE = 'com.google.android.apps.chrome' | 17 CHROME_PACKAGE = 'com.google.android.apps.chrome' |
19 CHROME_ACTIVITY = 'com.google.android.apps.chrome.Main' | 18 CHROME_ACTIVITY = 'com.google.android.apps.chrome.Main' |
20 CHROME_DEVTOOLS_SOCKET = 'chrome_devtools_remote' | 19 CHROME_DEVTOOLS_SOCKET = 'chrome_devtools_remote' |
21 | 20 |
22 CHROME_TESTS_PACKAGE = 'com.google.android.apps.chrome.tests' | 21 CHROME_TESTS_PACKAGE = 'com.google.android.apps.chrome.tests' |
23 | 22 |
24 LEGACY_BROWSER_PACKAGE = 'com.google.android.browser' | 23 LEGACY_BROWSER_PACKAGE = 'com.google.android.browser' |
25 LEGACY_BROWSER_ACTIVITY = 'com.android.browser.BrowserActivity' | 24 LEGACY_BROWSER_ACTIVITY = 'com.android.browser.BrowserActivity' |
26 | 25 |
27 CONTENT_SHELL_PACKAGE = 'org.chromium.content_shell_apk' | 26 CONTENT_SHELL_PACKAGE = 'org.chromium.content_shell_apk' |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 try: | 86 try: |
88 return os.environ['BUILDTYPE'] | 87 return os.environ['BUILDTYPE'] |
89 except KeyError: | 88 except KeyError: |
90 raise Exception('The BUILDTYPE environment variable has not been set') | 89 raise Exception('The BUILDTYPE environment variable has not been set') |
91 | 90 |
92 | 91 |
93 def SetBuildType(build_type): | 92 def SetBuildType(build_type): |
94 os.environ['BUILDTYPE'] = build_type | 93 os.environ['BUILDTYPE'] = build_type |
95 | 94 |
96 | 95 |
96 def GetCoverageDir(build_type=None): | |
frankf
2013/08/20 18:30:47
Where is this used?
gkanwar1
2013/08/20 18:37:13
This is used by the buildbot scripts. I put it wit
frankf
2013/08/20 18:47:43
Why do you need to take build_type as parameter?
gkanwar1
2013/08/20 18:56:18
Test-generated files (like logs, etc.) generally a
| |
97 if not build_type: | |
98 build_type = GetBuildType() | |
99 return os.path.join(DIR_SOURCE_ROOT, 'out', build_type, 'coverage') | |
100 | |
101 | |
97 def _GetADBPath(): | 102 def _GetADBPath(): |
98 if os.environ.get('ANDROID_SDK_ROOT'): | 103 if os.environ.get('ANDROID_SDK_ROOT'): |
99 return 'adb' | 104 return 'adb' |
100 # If envsetup.sh hasn't been sourced and there's no adb in the path, | 105 # If envsetup.sh hasn't been sourced and there's no adb in the path, |
101 # set it here. | 106 # set it here. |
102 try: | 107 try: |
103 with file(os.devnull, 'w') as devnull: | 108 with file(os.devnull, 'w') as devnull: |
104 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) | 109 subprocess.call(['adb', 'version'], stdout=devnull, stderr=devnull) |
105 return 'adb' | 110 return 'adb' |
106 except OSError: | 111 except OSError: |
107 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' | 112 print >> sys.stderr, 'No adb found in $PATH, fallback to checked in binary.' |
108 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') | 113 return os.path.join(ANDROID_SDK_ROOT, 'platform-tools', 'adb') |
109 | 114 |
110 | 115 |
111 ADB_PATH = _GetADBPath() | 116 ADB_PATH = _GetADBPath() |
112 | 117 |
113 # Exit codes | 118 # Exit codes |
114 ERROR_EXIT_CODE = 1 | 119 ERROR_EXIT_CODE = 1 |
115 WARNING_EXIT_CODE = 88 | 120 WARNING_EXIT_CODE = 88 |
OLD | NEW |