OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 Google Inc. All rights reserved. | 2 # Copyright (c) 2012 Google Inc. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 | 6 |
7 """Argument-less script to select what to run on the buildbots.""" | 7 """Argument-less script to select what to run on the buildbots.""" |
8 | 8 |
9 | 9 |
10 import filecmp | |
10 import os | 11 import os |
11 import shutil | 12 import shutil |
12 import subprocess | 13 import subprocess |
13 import sys | 14 import sys |
14 | 15 |
15 | 16 |
16 if sys.platform in ['win32', 'cygwin']: | 17 if sys.platform in ['win32', 'cygwin']: |
17 EXE_SUFFIX = '.exe' | 18 EXE_SUFFIX = '.exe' |
18 else: | 19 else: |
19 EXE_SUFFIX = '' | 20 EXE_SUFFIX = '' |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 | 76 |
76 _ANDROID_SETUP = 'source build/envsetup.sh && lunch full-eng' | 77 _ANDROID_SETUP = 'source build/envsetup.sh && lunch full-eng' |
77 | 78 |
78 | 79 |
79 def PrepareAndroidTree(): | 80 def PrepareAndroidTree(): |
80 """Prepare an Android tree to run 'android' format tests.""" | 81 """Prepare an Android tree to run 'android' format tests.""" |
81 if os.environ['BUILDBOT_CLOBBER'] == '1': | 82 if os.environ['BUILDBOT_CLOBBER'] == '1': |
82 print '@@@BUILD_STEP Clobber Android checkout@@@' | 83 print '@@@BUILD_STEP Clobber Android checkout@@@' |
83 shutil.rmtree(ANDROID_DIR) | 84 shutil.rmtree(ANDROID_DIR) |
84 | 85 |
85 # The release of Android we use is static, so there's no need to do anything | 86 # (Re)create the directory so that the following steps will succeed. |
86 # if the directory already exists. | 87 if not os.path.isdir(ANDROID_DIR): |
87 if os.path.isdir(ANDROID_DIR): | 88 os.mkdir(ANDROID_DIR) |
89 | |
90 # We use a manifest from the gyp project listing pinned revisions of AOSP to | |
91 # use, to ensure that we test against a stable target. This needs to be | |
92 # updated to pick up new build system changes sometimes, so we must test if | |
93 # it has changed. | |
94 manifest_filename = 'aosp_manifest.xml' | |
95 gyp_manifest = os.path.join(BUILDBOT_DIR, manifest_filename) | |
96 android_manifest = os.path.join(ANDROID_DIR, '.repo', 'manifests', | |
97 manifest_filename) | |
98 manifest_is_current = (os.path.isfile(android_manifest) and | |
99 filecmp.cmp(gyp_manifest, android_manifest)) | |
100 if not manifest_is_current: | |
101 # It's safe to repeat these steps, so just do them again to make sure we are | |
102 # in a good state. | |
103 print '@@@BUILD_STEP Initialize Android checkout@@@' | |
104 CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot']) | |
105 CallSubProcess(['git', 'config', '--global', | |
106 'user.email', 'chrome-bot@google.com']) | |
107 CallSubProcess(['git', 'config', '--global', 'color.ui', 'false']) | |
108 CallSubProcess( | |
109 ['repo', 'init', | |
110 '-u', 'https://android.googlesource.com/platform/manifest', | |
111 '-b', 'master', | |
112 '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'], | |
113 cwd=ANDROID_DIR) | |
114 shutil.copy(gyp_manifest, android_manifest) | |
115 | |
116 print '@@@BUILD_STEP Sync Android@@@' | |
117 CallSubProcess(['repo', 'sync', '-j4', '-m', manifest_filename], | |
118 cwd=ANDROID_DIR) | |
119 | |
120 # If we already built the system image successfully and didn't sync to a new | |
121 # version of the source, skip running the build again as it's expensive even | |
122 # when there's nothing to do. | |
123 system_img = os.path.join(ANDROID_DIR, 'out', 'target', 'product', 'generic', | |
124 'system.img') | |
125 if manifest_is_current and os.path.isfile(system_img): | |
88 return | 126 return |
89 | 127 |
90 print '@@@BUILD_STEP Initialize Android checkout@@@' | |
91 os.mkdir(ANDROID_DIR) | |
92 CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot']) | |
93 CallSubProcess(['git', 'config', '--global', | |
94 'user.email', 'chrome-bot@google.com']) | |
95 CallSubProcess(['git', 'config', '--global', 'color.ui', 'false']) | |
96 CallSubProcess( | |
97 ['repo', 'init', | |
98 '-u', 'https://android.googlesource.com/platform/manifest', | |
99 '-b', 'android-4.2.1_r1', | |
100 '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'], | |
101 cwd=ANDROID_DIR) | |
102 | |
103 print '@@@BUILD_STEP Sync Android@@@' | |
104 CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR) | |
105 | |
106 print '@@@BUILD_STEP Build Android@@@' | 128 print '@@@BUILD_STEP Build Android@@@' |
107 CallSubProcess( | 129 CallSubProcess( |
108 ['/bin/bash', | 130 ['/bin/bash', |
109 '-c', '%s && make -j4' % _ANDROID_SETUP], | 131 '-c', '%s && make -j4' % _ANDROID_SETUP], |
110 cwd=ANDROID_DIR) | 132 cwd=ANDROID_DIR) |
111 | 133 |
112 | 134 |
113 def StartAndroidEmulator(): | 135 def StartAndroidEmulator(): |
114 """Start an android emulator from the built android tree.""" | 136 """Start an android emulator from the built android tree.""" |
115 print '@@@BUILD_STEP Start Android emulator@@@' | 137 print '@@@BUILD_STEP Start Android emulator@@@' |
116 android_host_bin = '$ANDROID_HOST_OUT/bin' | |
jbudorick
2014/07/31 21:40:34
What happened here?
Torne
2014/08/01 09:57:42
The emulator is no longer built from source in cur
| |
117 subprocess.Popen( | 138 subprocess.Popen( |
118 ['/bin/bash', '-c', | 139 ['/bin/bash', '-c', |
119 '%s && %s/emulator -no-window' % (_ANDROID_SETUP, android_host_bin)], | 140 '%s && emulator -no-window' % _ANDROID_SETUP], |
120 cwd=ANDROID_DIR) | 141 cwd=ANDROID_DIR) |
121 CallSubProcess( | 142 CallSubProcess( |
122 ['/bin/bash', '-c', | 143 ['/bin/bash', '-c', |
123 '%s && %s/adb wait-for-device' % (_ANDROID_SETUP, android_host_bin)], | 144 '%s && adb wait-for-device' % _ANDROID_SETUP], |
124 cwd=ANDROID_DIR) | 145 cwd=ANDROID_DIR) |
125 | 146 |
126 | 147 |
127 def StopAndroidEmulator(): | 148 def StopAndroidEmulator(): |
128 """Stop all android emulators.""" | 149 """Stop all android emulators.""" |
129 print '@@@BUILD_STEP Stop Android emulator@@@' | 150 print '@@@BUILD_STEP Stop Android emulator@@@' |
130 # If this fails, it's because there is no emulator running. | 151 # If this fails, it's because there is no emulator running. |
131 subprocess.call(['pkill', 'emulator.*']) | 152 subprocess.call(['pkill', 'emulator.*']) |
132 | 153 |
133 | 154 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 # TODO(bradnelson): once the annotator supports a postscript (section for | 235 # TODO(bradnelson): once the annotator supports a postscript (section for |
215 # after the build proper that could be used for cumulative failures), | 236 # after the build proper that could be used for cumulative failures), |
216 # use that instead of this. This isolates the final return value so | 237 # use that instead of this. This isolates the final return value so |
217 # that it isn't misattributed to the last stage. | 238 # that it isn't misattributed to the last stage. |
218 print '@@@BUILD_STEP failures@@@' | 239 print '@@@BUILD_STEP failures@@@' |
219 sys.exit(retcode) | 240 sys.exit(retcode) |
220 | 241 |
221 | 242 |
222 if __name__ == '__main__': | 243 if __name__ == '__main__': |
223 GypBuild() | 244 GypBuild() |
OLD | NEW |