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

Side by Side Diff: utils/compiler/buildbot.py

Issue 10735017: Revert r9440. Turned the web-chrome-win7 bot red but I can't log (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | no next file » | 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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Dart frog buildbot steps 7 """Dart frog buildbot steps
8 8
9 Runs tests for the frog or dart2js compiler. 9 Runs tests for the frog or dart2js compiler.
10 """ 10 """
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 args, _ = parser.parse_args() 47 args, _ = parser.parse_args()
48 48
49 compiler = None 49 compiler = None
50 runtime = None 50 runtime = None
51 mode = None 51 mode = None
52 system = None 52 system = None
53 builder_name = os.environ.get(BUILDER_NAME) 53 builder_name = os.environ.get(BUILDER_NAME)
54 option = None 54 option = None
55 shard_index = None 55 shard_index = None
56 total_shards = None 56 total_shards = None
57 is_buildbot = True
58 if not builder_name: 57 if not builder_name:
59 # We are not running on a buildbot. 58 # We are not running on a buildbot.
60 is_buildbot = False
61 if args.name: 59 if args.name:
62 builder_name = args.name 60 builder_name = args.name
63 else: 61 else:
64 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' 62 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.'
65 sys.exit(1) 63 sys.exit(1)
66 64
67 if builder_name: 65 if builder_name:
68 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) 66 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name)
69 frog_pattern = re.match(FROG_BUILDER, builder_name) 67 frog_pattern = re.match(FROG_BUILDER, builder_name)
70 web_pattern = re.match(WEB_BUILDER, builder_name) 68 web_pattern = re.match(WEB_BUILDER, builder_name)
(...skipping 23 matching lines...) Expand all
94 92
95 if system == 'windows': 93 if system == 'windows':
96 system = 'win7' 94 system = 'win7'
97 95
98 if (system == 'win7' and platform.system() != 'Windows') or ( 96 if (system == 'win7' and platform.system() != 'Windows') or (
99 system == 'mac' and platform.system() != 'Darwin') or ( 97 system == 'mac' and platform.system() != 'Darwin') or (
100 system == 'linux' and platform.system() != 'Linux'): 98 system == 'linux' and platform.system() != 'Linux'):
101 print ('Error: You cannot emulate a buildbot with a platform different ' 99 print ('Error: You cannot emulate a buildbot with a platform different '
102 'from your own.') 100 'from your own.')
103 sys.exit(1) 101 sys.exit(1)
104 return (compiler, runtime, mode, system, option, shard_index, total_shards, 102 return (compiler, runtime, mode, system, option, shard_index, total_shards)
105 is_buildbot)
106 103
107 104
108 def NeedsXterm(compiler, runtime): 105 def NeedsXterm(compiler, runtime):
109 return runtime in ['ie', 'chrome', 'safari', 'opera', 'ff', 'drt'] 106 return runtime in ['ie', 'chrome', 'safari', 'opera', 'ff', 'drt']
110 107
111 def TestStep(name, mode, system, compiler, runtime, targets, flags): 108 def TestStep(name, mode, system, compiler, runtime, targets, flags):
112 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime, 109 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime,
113 ' '.join(flags)) 110 ' '.join(flags))
114 sys.stdout.flush() 111 sys.stdout.flush()
115 if NeedsXterm(compiler, runtime) and system == 'linux': 112 if NeedsXterm(compiler, runtime) and system == 'linux':
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 shutil.rmtree('frog/%s' % outdir, ignore_errors=True) 159 shutil.rmtree('frog/%s' % outdir, ignore_errors=True)
163 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) 160 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True)
164 161
165 os.chdir(DART_PATH) 162 os.chdir(DART_PATH)
166 163
167 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] 164 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk']
168 print 'running %s' % (' '.join(args)) 165 print 'running %s' % (' '.join(args))
169 return subprocess.call(args, env=NO_COLOR_ENV) 166 return subprocess.call(args, env=NO_COLOR_ENV)
170 167
171 168
172 def TestCompiler(compiler, runtime, mode, system, option, flags, is_buildbot): 169 def TestCompiler(compiler, runtime, mode, system, option, flags):
173 """ test the compiler. 170 """ test the compiler.
174 Args: 171 Args:
175 - compiler: either 'dart2js' or 'frog' 172 - compiler: either 'dart2js' or 'frog'
176 - runtime: either 'd8', or one of the browsers, see GetBuildInfo 173 - runtime: either 'd8', or one of the browsers, see GetBuildInfo
177 - mode: either 'debug' or 'release' 174 - mode: either 'debug' or 'release'
178 - system: either 'linux', 'mac', or 'win7' 175 - system: either 'linux', 'mac', or 'win7'
179 - option: 'checked' 176 - option: 'checked'
180 - flags: extra flags to pass to test.dart 177 - flags: extra flags to pass to test.dart
181 - is_buildbot: true if we are running on a real buildbot instead of
182 emulating one.
183 """ 178 """
184 179
185 # Make sure we are in the frog directory 180 # Make sure we are in the frog directory
186 os.chdir(DART_PATH) 181 os.chdir(DART_PATH)
187 182
188 if system.startswith('win') and runtime == 'ie': 183 if system.startswith('win') and runtime == 'ie':
189 # We don't do proper sharding on the IE bots, since the runtime is 184 # We don't do proper sharding on the IE bots, since the runtime is
190 # long for both. We have a "fast bot" and a "slow bot" that run specific 185 # long for both. We have a "fast bot" and a "slow bot" that run specific
191 # tests instead. 186 # tests instead.
192 for i in flags: 187 for i in flags:
193 if i.startswith('--shard='): 188 if i.startswith('--shard='):
194 bot_num = i.split('=')[1] 189 bot_num = i.split('=')[1]
195 # There should not be more than one InternetExplorerDriver instance 190 # There should not be more than one InternetExplorerDriver instance
196 # running at a time. For details, see 191 # running at a time. For details, see
197 # http://code.google.com/p/selenium/wiki/InternetExplorerDriver. 192 # http://code.google.com/p/selenium/wiki/InternetExplorerDriver.
198 flags = (filter(lambda(item): not item.startswith('--shard'), flags) + 193 flags = (filter(lambda(item): not item.startswith('--shard'), flags) +
199 ['-j1']) 194 ['-j1'])
200 195
201 def GetPath(runtime):
202 """ Helper to get the path to the Chrome or Firefox executable for a
203 particular platform on the buildbot. Throws a KeyError if runtime is not
204 either 'chrome' or 'ff'."""
205 if system == 'mac':
206 partDict = {'chrome': 'Google\\ Chrome', 'ff': 'Firefox'}
207 mac_path = '/Applications/%s.app/Contents/MacOS/%s'
208 path_dict = {'chrome': mac_path % (partDict[runtime], partDict[runtime]),
209 'ff': mac_path % (partDict[runtime], partDict[runtime].lower())}
210 elif system == 'linux':
211 path_dict = {'ff': 'firefox', 'chrome': 'google-chrome'}
212 else:
213 # Windows.
214 path_dict = {'ff': os.path.join('C:', 'Program Files (x86)',
215 'Mozilla Firefox', 'firefox.exe'),
216 'chrome': os.path.join('C:', 'Users', 'chrome-bot', 'AppData',
217 'Local', 'Google', 'Chrome', 'Application', 'chrome.exe')}
218 return path_dict[runtime]
219
220 if ((runtime == 'ff' or runtime == 'chrome') and is_buildbot and
221 not (runtime == 'chrome' and system == 'linux')): # chrome-linux runs drt.
222 # Print out browser version numbers if we're running on the buildbot (where
223 # we know the paths to these browser installations).
224 p = subprocess.Popen('%s --version' % GetPath(runtime),
225 stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
226 output, stderr = p.communicate()
227 print 'Version of %s: %s' % (runtime, output)
228
229 if system == 'linux' and runtime == 'chrome': 196 if system == 'linux' and runtime == 'chrome':
230 # TODO(ngeoffray): We should install selenium on the buildbot. 197 # TODO(ngeoffray): We should install selenium on the buildbot.
231 runtime = 'drt' 198 runtime = 'drt'
232 199
233 if compiler == 'dart2js': 200 if compiler == 'dart2js':
234 if option == 'checked': flags = flags + ['--host-checked'] 201 if option == 'checked': flags = flags + ['--host-checked']
235 202
236 if runtime == 'd8': 203 if runtime == 'd8':
237 # The dart2js compiler isn't self-hosted (yet) so we run its 204 # The dart2js compiler isn't self-hosted (yet) so we run its
238 # unit tests on the VM. We avoid doing this on the builders 205 # unit tests on the VM. We avoid doing this on the builders
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 _DeleteFirefoxProfiles('/tmp') 267 _DeleteFirefoxProfiles('/tmp')
301 _DeleteFirefoxProfiles('/var/tmp') 268 _DeleteFirefoxProfiles('/var/tmp')
302 269
303 def main(): 270 def main():
304 print '@@@BUILD_STEP build sdk@@@' 271 print '@@@BUILD_STEP build sdk@@@'
305 272
306 if len(sys.argv) == 0: 273 if len(sys.argv) == 0:
307 print 'Script pathname not known, giving up.' 274 print 'Script pathname not known, giving up.'
308 return 1 275 return 1
309 276
310 (compiler, runtime, mode, system, option, shard_index, total_shards, 277 compiler, runtime, mode, system, option, shard_index, total_shards = (
311 is_buildbot) = GetBuildInfo() 278 GetBuildInfo())
312 shard_description = "" 279 shard_description = ""
313 if shard_index: 280 if shard_index:
314 shard_description = " shard %s of %s" % (shard_index, total_shards) 281 shard_description = " shard %s of %s" % (shard_index, total_shards)
315 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( 282 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % (
316 compiler, runtime, mode, system, option, shard_description) 283 compiler, runtime, mode, system, option, shard_description)
317 if compiler is None: 284 if compiler is None:
318 return 1 285 return 1
319 286
320 status = BuildSDK(mode, system) 287 status = BuildSDK(mode, system)
321 if status != 0: 288 if status != 0:
322 print '@@@STEP_FAILURE@@@' 289 print '@@@STEP_FAILURE@@@'
323 return status 290 return status
324 291
325 test_flags = [] 292 test_flags = []
326 if shard_index: 293 if shard_index:
327 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] 294 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index]
328 295
329 # First we run all the regular tests. 296 # First we run all the regular tests.
330 status = TestCompiler(compiler, runtime, mode, system, option, test_flags, 297 status = TestCompiler(compiler, runtime, mode, system, option, test_flags)
331 is_buildbot)
332 298
333 # We only run checked mode tests when the host is not in checked mode. 299 # We only run checked mode tests when the host is not in checked mode.
334 if status == 0 and option != 'checked' and runtime == 'd8': 300 if status == 0 and option != 'checked' and runtime == 'd8':
335 status = TestCompiler(compiler, runtime, mode, system, option, 301 status = TestCompiler(compiler, runtime, mode, system, option,
336 test_flags + ['--checked'], is_buildbot) 302 test_flags + ['--checked'])
337 303
338 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) 304 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime)
339 if status != 0: print '@@@STEP_FAILURE@@@' 305 if status != 0: print '@@@STEP_FAILURE@@@'
340 return status 306 return status
341 307
342 if __name__ == '__main__': 308 if __name__ == '__main__':
343 sys.exit(main()) 309 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698