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

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

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