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

Side by Side Diff: tools/bots/compiler.py

Issue 25696002: Annotated steps script support for none-dartium builder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 6
7 """ 7 """
8 Dart2js buildbot steps 8 Dart2js buildbot steps
9 9
10 Runs tests for the dart2js compiler. 10 Runs tests for the dart2js compiler.
11 """ 11 """
12 12
13 import os 13 import os
14 import platform 14 import platform
15 import re 15 import re
16 import shutil 16 import shutil
17 import socket 17 import socket
18 import subprocess 18 import subprocess
19 import sys 19 import sys
20 20
21 import bot 21 import bot
22 22
23 DARTIUM_BUILDER = r'none-dartium-(linux|mac|windows)'
23 DART2JS_BUILDER = ( 24 DART2JS_BUILDER = (
24 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch ecked))?(-(host-checked))?(-(minified))?(-(x64))?-?(\d*)-?(\d*)') 25 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch ecked))?(-(host-checked))?(-(minified))?(-(x64))?-?(\d*)-?(\d*)')
25 WEB_BUILDER = ( 26 WEB_BUILDER = (
26 r'dart2js-(ie9|ie10|ff|safari|chrome|chromeOnAndroid|opera|drt)-(win7|win8|m ac10\.8|mac10\.7|linux)(-(all|html))?(-(csp))?(-(\d+)-(\d+))?') 27 r'dart2js-(ie9|ie10|ff|safari|chrome|chromeOnAndroid|opera|drt)-(win7|win8|m ac10\.8|mac10\.7|linux)(-(all|html))?(-(csp))?(-(\d+)-(\d+))?')
27 28
28 29
29 def GetBuildInfo(builder_name, is_buildbot): 30 def GetBuildInfo(builder_name, is_buildbot):
30 """Returns a BuildInfo object for the current buildbot based on the 31 """Returns a BuildInfo object for the current buildbot based on the
31 name of the builder. 32 name of the builder.
32 """ 33 """
33 compiler = None 34 compiler = None
34 runtime = None 35 runtime = None
35 mode = None 36 mode = None
36 system = None 37 system = None
37 checked = False 38 checked = False
38 host_checked = False 39 host_checked = False
39 minified = False 40 minified = False
40 shard_index = None 41 shard_index = None
41 total_shards = None 42 total_shards = None
42 test_set = None 43 test_set = None
43 csp = None 44 csp = None
44 arch = None 45 arch = None
45 46
46 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) 47 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name)
47 web_pattern = re.match(WEB_BUILDER, builder_name) 48 web_pattern = re.match(WEB_BUILDER, builder_name)
49 dartium_pattern = re.match(DARTIUM_BUILDER, builder_name)
48 50
49 if web_pattern: 51 if web_pattern:
50 compiler = 'dart2js' 52 compiler = 'dart2js'
51 runtime = web_pattern.group(1) 53 runtime = web_pattern.group(1)
52 system = web_pattern.group(2) 54 system = web_pattern.group(2)
53 mode = 'release' 55 mode = 'release'
54 test_set = web_pattern.group(4) 56 test_set = web_pattern.group(4)
55 if web_pattern.group(6) == 'csp': 57 if web_pattern.group(6) == 'csp':
56 csp = True 58 csp = True
57 shard_index = web_pattern.group(8) 59 shard_index = web_pattern.group(8)
(...skipping 16 matching lines...) Expand all
74 if dart2js_pattern.group(6) == 'host-checked': 76 if dart2js_pattern.group(6) == 'host-checked':
75 host_checked = True 77 host_checked = True
76 if dart2js_pattern.group(8) == 'host-checked': 78 if dart2js_pattern.group(8) == 'host-checked':
77 host_checked = True 79 host_checked = True
78 if dart2js_pattern.group(10) == 'minified': 80 if dart2js_pattern.group(10) == 'minified':
79 minified = True 81 minified = True
80 if dart2js_pattern.group(12) == 'x64': 82 if dart2js_pattern.group(12) == 'x64':
81 arch = 'x64' 83 arch = 'x64'
82 shard_index = dart2js_pattern.group(13) 84 shard_index = dart2js_pattern.group(13)
83 total_shards = dart2js_pattern.group(14) 85 total_shards = dart2js_pattern.group(14)
86 elif dartium_pattern:
87 compiler = 'none'
88 runtime = 'dartium'
89 mode = 'release'
90 system = dartium_pattern.group(1)
84 else : 91 else :
85 return None 92 return None
86 93
87 # We have both win7 and win8 bots, functionality is the same. 94 # We have both win7 and win8 bots, functionality is the same.
88 if system.startswith('win'): 95 if system.startswith('win'):
89 system = 'windows' 96 system = 'windows'
90 97
91 # We have both 10.8 and 10.7 bots, functionality is the same. 98 # We have both 10.8 and 10.7 bots, functionality is the same.
92 if system == 'mac10.8' or system == 'mac10.7': 99 if system == 'mac10.8' or system == 'mac10.7':
93 system = 'mac' 100 system = 'mac'
94 101
95 if (system == 'windows' and platform.system() != 'Windows') or ( 102 if (system == 'windows' and platform.system() != 'Windows') or (
96 system == 'mac' and platform.system() != 'Darwin') or ( 103 system == 'mac' and platform.system() != 'Darwin') or (
97 system == 'linux' and platform.system() != 'Linux'): 104 system == 'linux' and platform.system() != 'Linux'):
98 print ('Error: You cannot emulate a buildbot with a platform different ' 105 print ('Error: You cannot emulate a buildbot with a platform different '
99 'from your own.') 106 'from your own.')
100 return None 107 return None
101 return bot.BuildInfo(compiler, runtime, mode, system, checked, host_checked, 108 return bot.BuildInfo(compiler, runtime, mode, system, checked, host_checked,
102 minified, shard_index, total_shards, is_buildbot, 109 minified, shard_index, total_shards, is_buildbot,
103 test_set, csp, arch) 110 test_set, csp, arch)
104 111
105 112
106 def NeedsXterm(compiler, runtime): 113 def NeedsXterm(compiler, runtime):
107 return runtime in ['ie9', 'ie10', 'chrome', 'safari', 'opera', 'ff', 'drt'] 114 return runtime in ['ie9', 'ie10', 'chrome', 'safari', 'opera', 'ff', 'drt',
115 'dartium']
108 116
109 117
110 def TestStepName(name, flags): 118 def TestStepName(name, flags):
111 # Filter out flags with '=' as this breaks the /stats feature of the 119 # Filter out flags with '=' as this breaks the /stats feature of the
112 # build bot. 120 # build bot.
113 flags = [x for x in flags if not '=' in x] 121 flags = [x for x in flags if not '=' in x]
114 return ('%s tests %s' % (name, ' '.join(flags))).strip() 122 return ('%s tests %s' % (name, ' '.join(flags))).strip()
115 123
116 # TODO(ricow): remove this once we have browser controller drivers for all 124 # TODO(ricow): remove this once we have browser controller drivers for all
117 # supported platforms. 125 # supported platforms.
118 def UseBrowserController(runtime, system): 126 def UseBrowserController(runtime, system):
119 supported_platforms = { 127 supported_platforms = {
120 'linux': ['ff', 'chromeOnAndroid', 'chrome'], 128 'linux': ['ff', 'chromeOnAndroid', 'chrome', 'dartium'],
121 'mac': ['safari', 'chrome'], 129 'mac': ['safari', 'chrome', 'dartium'],
122 'windows': ['ie9', 'ie10', 'ff', 'chrome'] 130 'windows': ['ie9', 'ie10', 'ff', 'chrome', 'dartium']
123 } 131 }
124 # Platforms that we run on the fyi waterfall only. 132 # Platforms that we run on the fyi waterfall only.
125 fyi_supported_platforms = { 133 fyi_supported_platforms = {
126 'linux': [], 134 'linux': [],
127 'mac': [], 135 'mac': [],
128 'windows': [] 136 'windows': []
129 } 137 }
130 138
131 if (runtime in supported_platforms[system]): 139 if (runtime in supported_platforms[system]):
132 return True 140 return True
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 188
181 if flags: 189 if flags:
182 cmd.extend(flags) 190 cmd.extend(flags)
183 cmd.extend(targets) 191 cmd.extend(targets)
184 192
185 print 'Running: %s' % (' '.join(map(lambda arg: '"%s"' % arg, cmd))) 193 print 'Running: %s' % (' '.join(map(lambda arg: '"%s"' % arg, cmd)))
186 sys.stdout.flush() 194 sys.stdout.flush()
187 bot.RunProcess(cmd) 195 bot.RunProcess(cmd)
188 196
189 197
190 def TestCompiler(runtime, mode, system, flags, is_buildbot, test_set, arch): 198 def TestCompiler(runtime, mode, system, flags, is_buildbot, test_set, arch,
199 compiler=None):
191 """ test the compiler. 200 """ test the compiler.
192 Args: 201 Args:
193 - runtime: either 'd8', 'jsshell', or one of the browsers, see GetBuildInfo 202 - runtime: either 'd8', 'jsshell', or one of the browsers, see GetBuildInfo
194 - mode: either 'debug' or 'release' 203 - mode: either 'debug' or 'release'
195 - system: either 'linux', 'mac', 'windows' 204 - system: either 'linux', 'mac', 'windows'
196 - flags: extra flags to pass to test.dart 205 - flags: extra flags to pass to test.dart
197 - is_buildbot: true if we are running on a real buildbot instead of 206 - is_buildbot: true if we are running on a real buildbot instead of
198 emulating one. 207 emulating one.
199 - test_set: Specification of a non standard test set, default None 208 - test_set: Specification of a non standard test set, default None
200 - arch: The architecture to run on. 209 - arch: The architecture to run on.
210 - compiler: The compiler to use for test.py (default is 'dart2js').
201 """ 211 """
202 212
213 if not compiler:
214 compiler = 'dart2js'
215
203 def GetPath(runtime): 216 def GetPath(runtime):
204 """ Helper to get the path to the Chrome or Firefox executable for a 217 """ Helper to get the path to the Chrome or Firefox executable for a
205 particular platform on the buildbot. Throws a KeyError if runtime is not 218 particular platform on the buildbot. Throws a KeyError if runtime is not
206 either 'chrome' or 'ff'.""" 219 either 'chrome' or 'ff'."""
207 if system == 'mac': 220 if system == 'mac':
208 partDict = {'chrome': 'Google\\ Chrome', 'ff': 'Firefox'} 221 partDict = {'chrome': 'Google\\ Chrome', 'ff': 'Firefox'}
209 mac_path = '/Applications/%s.app/Contents/MacOS/%s' 222 mac_path = '/Applications/%s.app/Contents/MacOS/%s'
210 path_dict = {'chrome': mac_path % (partDict[runtime], partDict[runtime]), 223 path_dict = {'chrome': mac_path % (partDict[runtime], partDict[runtime]),
211 'ff': mac_path % (partDict[runtime], partDict[runtime].lower())} 224 'ff': mac_path % (partDict[runtime], partDict[runtime].lower())}
212 elif system == 'linux': 225 elif system == 'linux':
213 path_dict = {'ff': 'firefox', 'chrome': 'google-chrome'} 226 path_dict = {'ff': 'firefox', 'chrome': 'google-chrome'}
214 else: 227 else:
215 # Windows. 228 # Windows.
216 path_dict = {'ff': os.path.join('C:/', 'Program Files (x86)', 229 path_dict = {'ff': os.path.join('C:/', 'Program Files (x86)',
217 'Mozilla Firefox', 'firefox.exe'), 230 'Mozilla Firefox', 'firefox.exe'),
218 'chrome': os.path.join('C:/', 'Users', 'chrome-bot', 'AppData', 231 'chrome': os.path.join('C:/', 'Users', 'chrome-bot', 'AppData',
219 'Local', 'Google', 'Chrome', 'Application', 'chrome.exe')} 232 'Local', 'Google', 'Chrome', 'Application', 'chrome.exe')}
220 return path_dict[runtime] 233 return path_dict[runtime]
221 234
222 if (runtime == 'ff' or runtime == 'chrome') and is_buildbot: 235 if (compiler == 'dart2js' and (runtime == 'ff' or runtime == 'chrome')
236 and is_buildbot):
223 # Print out browser version numbers if we're running on the buildbot (where 237 # Print out browser version numbers if we're running on the buildbot (where
224 # we know the paths to these browser installations). 238 # we know the paths to these browser installations).
225 version_query_string = '"%s" --version' % GetPath(runtime) 239 version_query_string = '"%s" --version' % GetPath(runtime)
226 if runtime == 'ff' and system == 'windows': 240 if runtime == 'ff' and system == 'windows':
227 version_query_string += '| more' 241 version_query_string += '| more'
228 elif runtime == 'chrome' and system == 'windows': 242 elif runtime == 'chrome' and system == 'windows':
229 version_query_string = ('''reg query "HKCU\\Software\\Microsoft\\''' + 243 version_query_string = ('''reg query "HKCU\\Software\\Microsoft\\''' +
230 '''Windows\\CurrentVersion\\Uninstall\\Google Chrome" /v Version''') 244 '''Windows\\CurrentVersion\\Uninstall\\Google Chrome" /v Version''')
231 p = subprocess.Popen(version_query_string, 245 p = subprocess.Popen(version_query_string,
232 stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) 246 stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
233 output, stderr = p.communicate() 247 output, stderr = p.communicate()
234 output = output.split() 248 output = output.split()
235 try: 249 try:
236 print 'Version of %s: %s' % (runtime, output[-1]) 250 print 'Version of %s: %s' % (runtime, output[-1])
237 except IndexError: 251 except IndexError:
238 # Failed to obtain version information. Continue running tests. 252 # Failed to obtain version information. Continue running tests.
239 pass 253 pass
240 254
241 if runtime == 'd8': 255 if runtime == 'd8':
242 # The dart2js compiler isn't self-hosted (yet) so we run its 256 # The dart2js compiler isn't self-hosted (yet) so we run its
243 # unit tests on the VM. We avoid doing this on the builders 257 # unit tests on the VM. We avoid doing this on the builders
244 # that run the browser tests to cut down on the cycle time. 258 # that run the browser tests to cut down on the cycle time.
245 unit_test_flags = [flag for flag in flags if flag.startswith('--shard')] 259 unit_test_flags = [flag for flag in flags if flag.startswith('--shard')]
246 # Run the unit tests in checked mode (the VM's checked mode). 260 # Run the unit tests in checked mode (the VM's checked mode).
247 unit_test_flags.append('--checked') 261 unit_test_flags.append('--checked')
248 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['dart2js'], 262 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['dart2js'],
249 unit_test_flags, arch) 263 unit_test_flags, arch)
250 264
251 if system == 'windows' and runtime == 'ie10': 265 if compiler == 'dart2js' and system == 'windows' and runtime == 'ie10':
252 TestStep("dart2js", mode, system, 'dart2js', runtime, ['html'], flags, arch) 266 TestStep("%s-%s" % (compiler, runtime), mode, system, compiler, runtime,
267 ['html'], flags, arch)
253 else: 268 else:
254 # Run the default set of test suites. 269 # Run the default set of test suites.
255 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags, arch) 270 TestStep("%s-%s" % (compiler, runtime), mode, system, compiler,
271 runtime, [], flags, arch)
256 272
257 # TODO(kasperl): Consider running peg and css tests too. 273 if compiler == 'dart2js':
258 extras = ['dart2js_extra', 'dart2js_native'] 274 # TODO(kasperl): Consider running peg and css tests too.
259 extras_flags = flags 275 extras = ['dart2js_extra', 'dart2js_native']
260 if (system == 'linux' 276 extras_flags = flags
261 and runtime == 'd8' 277 if (system == 'linux'
262 and not '--host-checked' in extras_flags): 278 and runtime == 'd8'
263 # Run the extra tests in checked mode, but only on linux/d8. 279 and not '--host-checked' in extras_flags):
264 # Other systems have less resources and tend to time out. 280 # Run the extra tests in checked mode, but only on linux/d8.
265 extras_flags = extras_flags + ['--host-checked'] 281 # Other systems have less resources and tend to time out.
266 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extras, 282 extras_flags = extras_flags + ['--host-checked']
267 extras_flags, arch) 283 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extras,
284 extras_flags, arch)
268 285
269 286
270 def _DeleteTempWebdriverProfiles(directory): 287 def _DeleteTempWebdriverProfiles(directory):
271 """Find all the firefox profiles in a particular directory and delete them.""" 288 """Find all the firefox profiles in a particular directory and delete them."""
272 for f in os.listdir(directory): 289 for f in os.listdir(directory):
273 item = os.path.join(directory, f) 290 item = os.path.join(directory, f)
274 if os.path.isdir(item) and (f.startswith('tmp') or f.startswith('opera')): 291 if os.path.isdir(item) and (f.startswith('tmp') or f.startswith('opera')):
275 subprocess.Popen('rm -rf %s' % item, shell=True) 292 subprocess.Popen('rm -rf %s' % item, shell=True)
276 293
277 294
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if build_info.csp: test_flags += ['--csp'] 374 if build_info.csp: test_flags += ['--csp']
358 375
359 if build_info.runtime == 'chromeOnAndroid': 376 if build_info.runtime == 'chromeOnAndroid':
360 test_flags.append('--local_ip=%s' % GetLocalIPAddress()) 377 test_flags.append('--local_ip=%s' % GetLocalIPAddress())
361 # test.py expects the android tools directories to be in PATH 378 # test.py expects the android tools directories to be in PATH
362 # (they contain for example 'adb') 379 # (they contain for example 'adb')
363 AddAndroidToolsToPath() 380 AddAndroidToolsToPath()
364 381
365 TestCompiler(build_info.runtime, build_info.mode, build_info.system, 382 TestCompiler(build_info.runtime, build_info.mode, build_info.system,
366 list(test_flags), build_info.is_buildbot, build_info.test_set, 383 list(test_flags), build_info.is_buildbot, build_info.test_set,
367 build_info.arch) 384 build_info.arch, compiler=build_info.compiler)
368 385
369 # See comment in GetHasHardCodedCheckedMode, this is a hack. 386 # See comment in GetHasHardCodedCheckedMode, this is a hack.
370 if (GetHasHardCodedCheckedMode(build_info)): 387 if (GetHasHardCodedCheckedMode(build_info)):
371 TestCompiler(build_info.runtime, build_info.mode, build_info.system, 388 TestCompiler(build_info.runtime, build_info.mode, build_info.system,
372 test_flags + ['--checked'], build_info.is_buildbot, 389 test_flags + ['--checked'], build_info.is_buildbot,
373 build_info.test_set, build_info.arch) 390 build_info.test_set, build_info.arch,
391 compiler=build_info.compiler)
374 392
375 if build_info.runtime != 'd8': 393 if build_info.runtime != 'd8':
376 CleanUpTemporaryFiles(build_info.system, build_info.runtime) 394 CleanUpTemporaryFiles(build_info.system, build_info.runtime)
377 395
378 396
379 def BuildCompiler(build_info): 397 def BuildCompiler(build_info):
380 """ 398 """
381 Builds the SDK. 399 Builds the SDK.
382 400
383 - build_info: the buildInfo object, containing information about what sort of 401 - build_info: the buildInfo object, containing information about what sort of
384 build and test to be run. 402 build and test to be run.
385 """ 403 """
386 with bot.BuildStep('Build SDK and d8'): 404 with bot.BuildStep('Build SDK and d8'):
387 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, 405 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode,
388 '--arch=' + build_info.arch, 'dart2js_bot'] 406 '--arch=' + build_info.arch, 'dart2js_bot']
389 print 'Build SDK and d8: %s' % (' '.join(args)) 407 print 'Build SDK and d8: %s' % (' '.join(args))
390 bot.RunProcess(args) 408 bot.RunProcess(args)
391 409
392 410
393 if __name__ == '__main__': 411 if __name__ == '__main__':
394 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) 412 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler)
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