Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Side by Side Diff: buildbot/buildbot_run.py

Issue 321953005: [gyp][Android] Implement TestGypAndroid.run_built_executable. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pylib/gyp/generator/android.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 cwd=CMAKE_DIR) 66 cwd=CMAKE_DIR)
67 67
68 print '@@@BUILD_STEP Build CMake@@@' 68 print '@@@BUILD_STEP Build CMake@@@'
69 CallSubProcess( 69 CallSubProcess(
70 ['/bin/bash', 'bootstrap', '--prefix=%s' % CMAKE_DIR], 70 ['/bin/bash', 'bootstrap', '--prefix=%s' % CMAKE_DIR],
71 cwd=CMAKE_DIR) 71 cwd=CMAKE_DIR)
72 72
73 CallSubProcess( ['make', 'cmake'], cwd=CMAKE_DIR) 73 CallSubProcess( ['make', 'cmake'], cwd=CMAKE_DIR)
74 74
75 75
76 _ANDROID_SETUP = 'source build/envsetup.sh && lunch full-eng'
77
78
76 def PrepareAndroidTree(): 79 def PrepareAndroidTree():
77 """Prepare an Android tree to run 'android' format tests.""" 80 """Prepare an Android tree to run 'android' format tests."""
78 if os.environ['BUILDBOT_CLOBBER'] == '1': 81 if os.environ['BUILDBOT_CLOBBER'] == '1':
79 print '@@@BUILD_STEP Clobber Android checkout@@@' 82 print '@@@BUILD_STEP Clobber Android checkout@@@'
80 shutil.rmtree(ANDROID_DIR) 83 shutil.rmtree(ANDROID_DIR)
81 84
82 # The release of Android we use is static, so there's no need to do anything 85 # The release of Android we use is static, so there's no need to do anything
83 # if the directory already exists. 86 # if the directory already exists.
84 if os.path.isdir(ANDROID_DIR): 87 if os.path.isdir(ANDROID_DIR):
85 return 88 return
(...skipping 10 matching lines...) Expand all
96 '-b', 'android-4.2.1_r1', 99 '-b', 'android-4.2.1_r1',
97 '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'], 100 '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'],
98 cwd=ANDROID_DIR) 101 cwd=ANDROID_DIR)
99 102
100 print '@@@BUILD_STEP Sync Android@@@' 103 print '@@@BUILD_STEP Sync Android@@@'
101 CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR) 104 CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR)
102 105
103 print '@@@BUILD_STEP Build Android@@@' 106 print '@@@BUILD_STEP Build Android@@@'
104 CallSubProcess( 107 CallSubProcess(
105 ['/bin/bash', 108 ['/bin/bash',
106 '-c', 'source build/envsetup.sh && lunch full-eng && make -j4'], 109 '-c', '%s && make -j4' % _ANDROID_SETUP],
107 cwd=ANDROID_DIR) 110 cwd=ANDROID_DIR)
108 111
109 112
113 def StartAndroidEmulator():
114 """Start an android emulator from the built android tree."""
115 print '@@@BUILD_STEP Start Android emulator@@@'
116 android_host_bin = '$ANDROID_HOST_OUT/bin'
117 subprocess.Popen(
118 ['/bin/bash', '-c',
119 '%s && %s/emulator -no-window' % (_ANDROID_SETUP, android_host_bin)],
120 cwd=ANDROID_DIR)
121 CallSubProcess(
122 ['/bin/bash', '-c',
123 '%s && %s/adb wait-for-device' % (_ANDROID_SETUP, android_host_bin)],
124 cwd=ANDROID_DIR)
125
126
127 def StopAndroidEmulator():
128 """Stop all android emulators."""
129 print '@@@BUILD_STEP Stop Android emulator@@@'
130 # If this fails, it's because there is no emulator running.
131 subprocess.call(['pkill', 'emulator.*'])
132
133
110 def GypTestFormat(title, format=None, msvs_version=None, tests=[]): 134 def GypTestFormat(title, format=None, msvs_version=None, tests=[]):
111 """Run the gyp tests for a given format, emitting annotator tags. 135 """Run the gyp tests for a given format, emitting annotator tags.
112 136
113 See annotator docs at: 137 See annotator docs at:
114 https://sites.google.com/a/chromium.org/dev/developers/testing/chromium-buil d-infrastructure/buildbot-annotations 138 https://sites.google.com/a/chromium.org/dev/developers/testing/chromium-buil d-infrastructure/buildbot-annotations
115 Args: 139 Args:
116 format: gyp format to test. 140 format: gyp format to test.
117 Returns: 141 Returns:
118 0 for sucesss, 1 for failure. 142 0 for sucesss, 1 for failure.
119 """ 143 """
(...skipping 10 matching lines...) Expand all
130 '--all', 154 '--all',
131 '--passed', 155 '--passed',
132 '--format', format, 156 '--format', format,
133 '--path', CMAKE_BIN_DIR, 157 '--path', CMAKE_BIN_DIR,
134 '--chdir', 'trunk'] + tests) 158 '--chdir', 'trunk'] + tests)
135 if format == 'android': 159 if format == 'android':
136 # gyptest needs the environment setup from envsetup/lunch in order to build 160 # gyptest needs the environment setup from envsetup/lunch in order to build
137 # using the 'android' backend, so this is done in a single shell. 161 # using the 'android' backend, so this is done in a single shell.
138 retcode = subprocess.call( 162 retcode = subprocess.call(
139 ['/bin/bash', 163 ['/bin/bash',
140 '-c', 'source build/envsetup.sh && lunch full-eng && cd %s && %s' 164 '-c', '%s && cd %s && %s' % (_ANDROID_SETUP, ROOT_DIR, command)],
141 % (ROOT_DIR, command)],
142 cwd=ANDROID_DIR, env=env) 165 cwd=ANDROID_DIR, env=env)
143 else: 166 else:
144 retcode = subprocess.call(command, cwd=ROOT_DIR, env=env, shell=True) 167 retcode = subprocess.call(command, cwd=ROOT_DIR, env=env, shell=True)
145 if retcode: 168 if retcode:
146 # Emit failure tag, and keep going. 169 # Emit failure tag, and keep going.
147 print '@@@STEP_FAILURE@@@' 170 print '@@@STEP_FAILURE@@@'
148 return 1 171 return 1
149 return 0 172 return 0
150 173
151 174
152 def GypBuild(): 175 def GypBuild():
153 # Dump out/ directory. 176 # Dump out/ directory.
154 print '@@@BUILD_STEP cleanup@@@' 177 print '@@@BUILD_STEP cleanup@@@'
155 print 'Removing %s...' % OUT_DIR 178 print 'Removing %s...' % OUT_DIR
156 shutil.rmtree(OUT_DIR, ignore_errors=True) 179 shutil.rmtree(OUT_DIR, ignore_errors=True)
157 print 'Done.' 180 print 'Done.'
158 181
159 retcode = 0 182 retcode = 0
160 # The Android gyp bot runs on linux so this must be tested first. 183 # The Android gyp bot runs on linux so this must be tested first.
161 if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android': 184 if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android':
162 PrepareAndroidTree() 185 PrepareAndroidTree()
163 retcode += GypTestFormat('android') 186 StartAndroidEmulator()
187 try:
188 retcode += GypTestFormat('android')
189 finally:
190 StopAndroidEmulator()
164 elif sys.platform.startswith('linux'): 191 elif sys.platform.startswith('linux'):
165 retcode += GypTestFormat('ninja') 192 retcode += GypTestFormat('ninja')
166 retcode += GypTestFormat('make') 193 retcode += GypTestFormat('make')
167 PrepareCmake() 194 PrepareCmake()
168 retcode += GypTestFormat('cmake') 195 retcode += GypTestFormat('cmake')
169 elif sys.platform == 'darwin': 196 elif sys.platform == 'darwin':
170 retcode += GypTestFormat('ninja') 197 retcode += GypTestFormat('ninja')
171 retcode += GypTestFormat('xcode') 198 retcode += GypTestFormat('xcode')
172 retcode += GypTestFormat('make') 199 retcode += GypTestFormat('make')
173 elif sys.platform == 'win32': 200 elif sys.platform == 'win32':
(...skipping 13 matching lines...) Expand all
187 # TODO(bradnelson): once the annotator supports a postscript (section for 214 # TODO(bradnelson): once the annotator supports a postscript (section for
188 # after the build proper that could be used for cumulative failures), 215 # after the build proper that could be used for cumulative failures),
189 # use that instead of this. This isolates the final return value so 216 # use that instead of this. This isolates the final return value so
190 # that it isn't misattributed to the last stage. 217 # that it isn't misattributed to the last stage.
191 print '@@@BUILD_STEP failures@@@' 218 print '@@@BUILD_STEP failures@@@'
192 sys.exit(retcode) 219 sys.exit(retcode)
193 220
194 221
195 if __name__ == '__main__': 222 if __name__ == '__main__':
196 GypBuild() 223 GypBuild()
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/android.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698