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 os | 10 import os |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 print '@@@BUILD_STEP Sync Android@@@' | 100 print '@@@BUILD_STEP Sync Android@@@' |
101 CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR) | 101 CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR) |
102 | 102 |
103 print '@@@BUILD_STEP Build Android@@@' | 103 print '@@@BUILD_STEP Build Android@@@' |
104 CallSubProcess( | 104 CallSubProcess( |
105 ['/bin/bash', | 105 ['/bin/bash', |
106 '-c', 'source build/envsetup.sh && lunch full-eng && make -j4'], | 106 '-c', 'source build/envsetup.sh && lunch full-eng && make -j4'], |
107 cwd=ANDROID_DIR) | 107 cwd=ANDROID_DIR) |
108 | 108 |
109 | 109 |
| 110 def StartAndroidEmulator(): |
| 111 """Start an android emulator from the built android tree.""" |
| 112 print '@@@BUILD_STEP Start Android emulator@@@' |
| 113 subprocess.Popen( |
| 114 ['/bin/bash', '-c', |
| 115 'source build/envsetup.sh && $ANDROID_HOST_OUT/bin/emulator'], |
| 116 cwd=ANDROID_DIR) |
| 117 CallSubProcess( |
| 118 ['/bin/bash', '-c', |
| 119 'source build/envsetup.sh && $ANDROID_HOST_OUT/bin/adb wait-for-device'], |
| 120 cwd=ANDROID_DIR) |
| 121 |
| 122 |
| 123 def StopAndroidEmulator(): |
| 124 """Stop all android emulators.""" |
| 125 print '@@@BUILD_STEP Stop Android emulator@@@' |
| 126 # If this fails, it's because there is no emulator running. |
| 127 subprocess.call(['pkill', 'emulator.*']) |
| 128 |
| 129 |
110 def GypTestFormat(title, format=None, msvs_version=None, tests=[]): | 130 def GypTestFormat(title, format=None, msvs_version=None, tests=[]): |
111 """Run the gyp tests for a given format, emitting annotator tags. | 131 """Run the gyp tests for a given format, emitting annotator tags. |
112 | 132 |
113 See annotator docs at: | 133 See annotator docs at: |
114 https://sites.google.com/a/chromium.org/dev/developers/testing/chromium-buil
d-infrastructure/buildbot-annotations | 134 https://sites.google.com/a/chromium.org/dev/developers/testing/chromium-buil
d-infrastructure/buildbot-annotations |
115 Args: | 135 Args: |
116 format: gyp format to test. | 136 format: gyp format to test. |
117 Returns: | 137 Returns: |
118 0 for sucesss, 1 for failure. | 138 0 for sucesss, 1 for failure. |
119 """ | 139 """ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 # Dump out/ directory. | 173 # Dump out/ directory. |
154 print '@@@BUILD_STEP cleanup@@@' | 174 print '@@@BUILD_STEP cleanup@@@' |
155 print 'Removing %s...' % OUT_DIR | 175 print 'Removing %s...' % OUT_DIR |
156 shutil.rmtree(OUT_DIR, ignore_errors=True) | 176 shutil.rmtree(OUT_DIR, ignore_errors=True) |
157 print 'Done.' | 177 print 'Done.' |
158 | 178 |
159 retcode = 0 | 179 retcode = 0 |
160 # The Android gyp bot runs on linux so this must be tested first. | 180 # The Android gyp bot runs on linux so this must be tested first. |
161 if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android': | 181 if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android': |
162 PrepareAndroidTree() | 182 PrepareAndroidTree() |
163 retcode += GypTestFormat('android') | 183 StartAndroidEmulator() |
| 184 try: |
| 185 retcode += GypTestFormat('android') |
| 186 finally: |
| 187 StopAndroidEmulator() |
164 elif sys.platform.startswith('linux'): | 188 elif sys.platform.startswith('linux'): |
165 retcode += GypTestFormat('ninja') | 189 retcode += GypTestFormat('ninja') |
166 retcode += GypTestFormat('make') | 190 retcode += GypTestFormat('make') |
167 PrepareCmake() | 191 PrepareCmake() |
168 retcode += GypTestFormat('cmake') | 192 retcode += GypTestFormat('cmake') |
169 elif sys.platform == 'darwin': | 193 elif sys.platform == 'darwin': |
170 retcode += GypTestFormat('ninja') | 194 retcode += GypTestFormat('ninja') |
171 retcode += GypTestFormat('xcode') | 195 retcode += GypTestFormat('xcode') |
172 retcode += GypTestFormat('make') | 196 retcode += GypTestFormat('make') |
173 elif sys.platform == 'win32': | 197 elif sys.platform == 'win32': |
(...skipping 13 matching lines...) Expand all Loading... |
187 # TODO(bradnelson): once the annotator supports a postscript (section for | 211 # TODO(bradnelson): once the annotator supports a postscript (section for |
188 # after the build proper that could be used for cumulative failures), | 212 # after the build proper that could be used for cumulative failures), |
189 # use that instead of this. This isolates the final return value so | 213 # use that instead of this. This isolates the final return value so |
190 # that it isn't misattributed to the last stage. | 214 # that it isn't misattributed to the last stage. |
191 print '@@@BUILD_STEP failures@@@' | 215 print '@@@BUILD_STEP failures@@@' |
192 sys.exit(retcode) | 216 sys.exit(retcode) |
193 | 217 |
194 | 218 |
195 if __name__ == '__main__': | 219 if __name__ == '__main__': |
196 GypBuild() | 220 GypBuild() |
OLD | NEW |