OLD | NEW |
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 DART2JS_BUILDER = ( | 23 DART2JS_BUILDER = ( |
24 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch
ecked))?(-(host-checked))?(-(minified))?-?(\d*)-?(\d*)') | 24 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch
ecked))?(-(host-checked))?(-(minified))?(-(x64))?-?(\d*)-?(\d*)') |
25 WEB_BUILDER = ( | 25 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+))?') | 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 | 27 |
28 | 28 |
29 def GetBuildInfo(builder_name, is_buildbot): | 29 def GetBuildInfo(builder_name, is_buildbot): |
30 """Returns a BuildInfo object for the current buildbot based on the | 30 """Returns a BuildInfo object for the current buildbot based on the |
31 name of the builder. | 31 name of the builder. |
32 """ | 32 """ |
33 compiler = None | 33 compiler = None |
34 runtime = None | 34 runtime = None |
35 mode = None | 35 mode = None |
36 system = None | 36 system = None |
37 checked = False | 37 checked = False |
38 host_checked = False | 38 host_checked = False |
39 minified = False | 39 minified = False |
40 shard_index = None | 40 shard_index = None |
41 total_shards = None | 41 total_shards = None |
42 test_set = None | 42 test_set = None |
43 csp = None | 43 csp = None |
| 44 arch = None |
44 | 45 |
45 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) | 46 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) |
46 web_pattern = re.match(WEB_BUILDER, builder_name) | 47 web_pattern = re.match(WEB_BUILDER, builder_name) |
47 | 48 |
48 if web_pattern: | 49 if web_pattern: |
49 compiler = 'dart2js' | 50 compiler = 'dart2js' |
50 runtime = web_pattern.group(1) | 51 runtime = web_pattern.group(1) |
51 system = web_pattern.group(2) | 52 system = web_pattern.group(2) |
52 mode = 'release' | 53 mode = 'release' |
53 test_set = web_pattern.group(4) | 54 test_set = web_pattern.group(4) |
54 if web_pattern.group(6) == 'csp': | 55 if web_pattern.group(6) == 'csp': |
55 csp = True | 56 csp = True |
56 shard_index = web_pattern.group(8) | 57 shard_index = web_pattern.group(8) |
57 total_shards = web_pattern.group(9) | 58 total_shards = web_pattern.group(9) |
58 elif dart2js_pattern: | 59 elif dart2js_pattern: |
59 compiler = 'dart2js' | 60 compiler = 'dart2js' |
60 system = dart2js_pattern.group(1) | 61 system = dart2js_pattern.group(1) |
61 runtime = 'd8' | 62 runtime = 'd8' |
| 63 arch = 'ia32' |
62 if dart2js_pattern.group(3) == 'jsshell': | 64 if dart2js_pattern.group(3) == 'jsshell': |
63 runtime = 'jsshell' | 65 runtime = 'jsshell' |
64 mode = dart2js_pattern.group(4) | 66 mode = dart2js_pattern.group(4) |
65 # The valid naming parts for checked and host-checked are: | 67 # The valid naming parts for checked and host-checked are: |
66 # Empty: checked=False, host_checked=False | 68 # Empty: checked=False, host_checked=False |
67 # -checked: checked=True, host_checked=False | 69 # -checked: checked=True, host_checked=False |
68 # -host-checked: checked=False, host_checked=True | 70 # -host-checked: checked=False, host_checked=True |
69 # -checked-host-checked: checked=True, host_checked=True | 71 # -checked-host-checked: checked=True, host_checked=True |
70 if dart2js_pattern.group(6) == 'checked': | 72 if dart2js_pattern.group(6) == 'checked': |
71 checked = True | 73 checked = True |
72 if dart2js_pattern.group(6) == 'host-checked': | 74 if dart2js_pattern.group(6) == 'host-checked': |
73 host_checked = True | 75 host_checked = True |
74 if dart2js_pattern.group(8) == 'host-checked': | 76 if dart2js_pattern.group(8) == 'host-checked': |
75 host_checked = True | 77 host_checked = True |
76 if dart2js_pattern.group(10) == 'minified': | 78 if dart2js_pattern.group(10) == 'minified': |
77 minified = True | 79 minified = True |
78 shard_index = dart2js_pattern.group(11) | 80 if dart2js_pattern.group(12) == 'x64': |
79 total_shards = dart2js_pattern.group(12) | 81 arch = 'x64' |
| 82 shard_index = dart2js_pattern.group(13) |
| 83 total_shards = dart2js_pattern.group(14) |
80 else : | 84 else : |
81 return None | 85 return None |
82 | 86 |
83 # We have both win7 and win8 bots, functionality is the same. | 87 # We have both win7 and win8 bots, functionality is the same. |
84 if system.startswith('win'): | 88 if system.startswith('win'): |
85 system = 'windows' | 89 system = 'windows' |
86 | 90 |
87 # We have both 10.8 and 10.7 bots, functionality is the same. | 91 # We have both 10.8 and 10.7 bots, functionality is the same. |
88 if system == 'mac10.8' or system == 'mac10.7': | 92 if system == 'mac10.8' or system == 'mac10.7': |
89 system = 'mac' | 93 system = 'mac' |
90 | 94 |
91 if (system == 'windows' and platform.system() != 'Windows') or ( | 95 if (system == 'windows' and platform.system() != 'Windows') or ( |
92 system == 'mac' and platform.system() != 'Darwin') or ( | 96 system == 'mac' and platform.system() != 'Darwin') or ( |
93 system == 'linux' and platform.system() != 'Linux'): | 97 system == 'linux' and platform.system() != 'Linux'): |
94 print ('Error: You cannot emulate a buildbot with a platform different ' | 98 print ('Error: You cannot emulate a buildbot with a platform different ' |
95 'from your own.') | 99 'from your own.') |
96 return None | 100 return None |
97 return bot.BuildInfo(compiler, runtime, mode, system, checked, host_checked, | 101 return bot.BuildInfo(compiler, runtime, mode, system, checked, host_checked, |
98 minified, shard_index, total_shards, is_buildbot, | 102 minified, shard_index, total_shards, is_buildbot, |
99 test_set, csp) | 103 test_set, csp, arch) |
100 | 104 |
101 | 105 |
102 def NeedsXterm(compiler, runtime): | 106 def NeedsXterm(compiler, runtime): |
103 return runtime in ['ie9', 'ie10', 'chrome', 'safari', 'opera', 'ff', 'drt'] | 107 return runtime in ['ie9', 'ie10', 'chrome', 'safari', 'opera', 'ff', 'drt'] |
104 | 108 |
105 | 109 |
106 def TestStepName(name, flags): | 110 def TestStepName(name, flags): |
107 # Filter out flags with '=' as this breaks the /stats feature of the | 111 # Filter out flags with '=' as this breaks the /stats feature of the |
108 # build bot. | 112 # build bot. |
109 flags = [x for x in flags if not '=' in x] | 113 flags = [x for x in flags if not '=' in x] |
(...skipping 18 matching lines...) Expand all Loading... |
128 return True | 132 return True |
129 | 133 |
130 if (os.environ.get('BUILDBOT_SCHEDULER') == "fyi-main" and | 134 if (os.environ.get('BUILDBOT_SCHEDULER') == "fyi-main" and |
131 runtime in fyi_supported_platforms[system]): | 135 runtime in fyi_supported_platforms[system]): |
132 return True | 136 return True |
133 | 137 |
134 return False | 138 return False |
135 | 139 |
136 | 140 |
137 IsFirstTestStepCall = True | 141 IsFirstTestStepCall = True |
138 def TestStep(name, mode, system, compiler, runtime, targets, flags): | 142 def TestStep(name, mode, system, compiler, runtime, targets, flags, arch): |
139 step_name = TestStepName(name, flags) | 143 step_name = TestStepName(name, flags) |
140 with bot.BuildStep(step_name, swallow_error=True): | 144 with bot.BuildStep(step_name, swallow_error=True): |
141 sys.stdout.flush() | 145 sys.stdout.flush() |
142 if NeedsXterm(compiler, runtime) and system == 'linux': | 146 if NeedsXterm(compiler, runtime) and system == 'linux': |
143 cmd = ['xvfb-run', '-a'] | 147 cmd = ['xvfb-run', '-a'] |
144 else: | 148 else: |
145 cmd = [] | 149 cmd = [] |
146 | 150 |
147 user_test = os.environ.get('USER_TEST', 'no') | 151 user_test = os.environ.get('USER_TEST', 'no') |
148 | 152 |
149 cmd.extend([sys.executable, | 153 cmd.extend([sys.executable, |
150 os.path.join(os.curdir, 'tools', 'test.py'), | 154 os.path.join(os.curdir, 'tools', 'test.py'), |
151 '--step_name=' + step_name, | 155 '--step_name=' + step_name, |
152 '--mode=' + mode, | 156 '--mode=' + mode, |
153 '--compiler=' + compiler, | 157 '--compiler=' + compiler, |
154 '--runtime=' + runtime, | 158 '--runtime=' + runtime, |
| 159 '--arch=' + arch, |
155 '--time', | 160 '--time', |
156 '--use-sdk', | 161 '--use-sdk', |
157 '--report', | 162 '--report', |
158 '--write-debug-log']) | 163 '--write-debug-log']) |
159 | 164 |
160 if user_test == 'yes': | 165 if user_test == 'yes': |
161 cmd.append('--progress=color') | 166 cmd.append('--progress=color') |
162 else: | 167 else: |
163 cmd.extend(['--progress=buildbot', '-v']) | 168 cmd.extend(['--progress=buildbot', '-v']) |
164 | 169 |
165 if UseBrowserController(runtime, system): | 170 if UseBrowserController(runtime, system): |
166 cmd.append('--use_browser_controller') | 171 cmd.append('--use_browser_controller') |
167 if runtime == 'safari': | 172 if runtime == 'safari': |
168 cmd.append('--clear_safari_cache') | 173 cmd.append('--clear_safari_cache') |
169 | 174 |
170 global IsFirstTestStepCall | 175 global IsFirstTestStepCall |
171 if IsFirstTestStepCall: | 176 if IsFirstTestStepCall: |
172 IsFirstTestStepCall = False | 177 IsFirstTestStepCall = False |
173 else: | 178 else: |
174 cmd.append('--append_logs') | 179 cmd.append('--append_logs') |
175 | 180 |
176 if flags: | 181 if flags: |
177 cmd.extend(flags) | 182 cmd.extend(flags) |
178 cmd.extend(targets) | 183 cmd.extend(targets) |
179 | 184 |
180 print 'Running: %s' % (' '.join(map(lambda arg: '"%s"' % arg, cmd))) | 185 print 'Running: %s' % (' '.join(map(lambda arg: '"%s"' % arg, cmd))) |
181 bot.RunProcess(cmd) | 186 bot.RunProcess(cmd) |
182 | 187 |
183 | 188 |
184 def TestCompiler(runtime, mode, system, flags, is_buildbot, test_set): | 189 def TestCompiler(runtime, mode, system, flags, is_buildbot, test_set, arch): |
185 """ test the compiler. | 190 """ test the compiler. |
186 Args: | 191 Args: |
187 - runtime: either 'd8', 'jsshell', or one of the browsers, see GetBuildInfo | 192 - runtime: either 'd8', 'jsshell', or one of the browsers, see GetBuildInfo |
188 - mode: either 'debug' or 'release' | 193 - mode: either 'debug' or 'release' |
189 - system: either 'linux', 'mac', 'windows' | 194 - system: either 'linux', 'mac', 'windows' |
190 - flags: extra flags to pass to test.dart | 195 - flags: extra flags to pass to test.dart |
191 - is_buildbot: true if we are running on a real buildbot instead of | 196 - is_buildbot: true if we are running on a real buildbot instead of |
192 emulating one. | 197 emulating one. |
193 - test_set: Specification of a non standard test set, default None | 198 - test_set: Specification of a non standard test set, default None |
| 199 - arch: The architecture to run on. |
194 """ | 200 """ |
195 | 201 |
196 def GetPath(runtime): | 202 def GetPath(runtime): |
197 """ Helper to get the path to the Chrome or Firefox executable for a | 203 """ Helper to get the path to the Chrome or Firefox executable for a |
198 particular platform on the buildbot. Throws a KeyError if runtime is not | 204 particular platform on the buildbot. Throws a KeyError if runtime is not |
199 either 'chrome' or 'ff'.""" | 205 either 'chrome' or 'ff'.""" |
200 if system == 'mac': | 206 if system == 'mac': |
201 partDict = {'chrome': 'Google\\ Chrome', 'ff': 'Firefox'} | 207 partDict = {'chrome': 'Google\\ Chrome', 'ff': 'Firefox'} |
202 mac_path = '/Applications/%s.app/Contents/MacOS/%s' | 208 mac_path = '/Applications/%s.app/Contents/MacOS/%s' |
203 path_dict = {'chrome': mac_path % (partDict[runtime], partDict[runtime]), | 209 path_dict = {'chrome': mac_path % (partDict[runtime], partDict[runtime]), |
(...skipping 28 matching lines...) Expand all Loading... |
232 pass | 238 pass |
233 | 239 |
234 if runtime == 'd8': | 240 if runtime == 'd8': |
235 # The dart2js compiler isn't self-hosted (yet) so we run its | 241 # The dart2js compiler isn't self-hosted (yet) so we run its |
236 # unit tests on the VM. We avoid doing this on the builders | 242 # unit tests on the VM. We avoid doing this on the builders |
237 # that run the browser tests to cut down on the cycle time. | 243 # that run the browser tests to cut down on the cycle time. |
238 unit_test_flags = [flag for flag in flags if flag.startswith('--shard')] | 244 unit_test_flags = [flag for flag in flags if flag.startswith('--shard')] |
239 # Run the unit tests in checked mode (the VM's checked mode). | 245 # Run the unit tests in checked mode (the VM's checked mode). |
240 unit_test_flags.append('--checked') | 246 unit_test_flags.append('--checked') |
241 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['dart2js'], | 247 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['dart2js'], |
242 unit_test_flags) | 248 unit_test_flags, arch) |
243 | 249 |
244 if system == 'windows' and runtime == 'ie10': | 250 if system == 'windows' and runtime == 'ie10': |
245 TestStep("dart2js", mode, system, 'dart2js', runtime, ['html'], flags) | 251 TestStep("dart2js", mode, system, 'dart2js', runtime, ['html'], flags, arch) |
246 else: | 252 else: |
247 # Run the default set of test suites. | 253 # Run the default set of test suites. |
248 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) | 254 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags, arch) |
249 | 255 |
250 # TODO(kasperl): Consider running peg and css tests too. | 256 # TODO(kasperl): Consider running peg and css tests too. |
251 extras = ['dart2js_extra', 'dart2js_native', 'dart2js_foreign'] | 257 extras = ['dart2js_extra', 'dart2js_native', 'dart2js_foreign'] |
252 extras_flags = flags | 258 extras_flags = flags |
253 if (system == 'linux' | 259 if (system == 'linux' |
254 and runtime == 'd8' | 260 and runtime == 'd8' |
255 and not '--host-checked' in extras_flags): | 261 and not '--host-checked' in extras_flags): |
256 # Run the extra tests in checked mode, but only on linux/d8. | 262 # Run the extra tests in checked mode, but only on linux/d8. |
257 # Other systems have less resources and tend to time out. | 263 # Other systems have less resources and tend to time out. |
258 extras_flags = extras_flags + ['--host-checked'] | 264 extras_flags = extras_flags + ['--host-checked'] |
259 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extras, | 265 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extras, |
260 extras_flags) | 266 extras_flags, arch) |
261 | 267 |
262 | 268 |
263 def _DeleteTempWebdriverProfiles(directory): | 269 def _DeleteTempWebdriverProfiles(directory): |
264 """Find all the firefox profiles in a particular directory and delete them.""" | 270 """Find all the firefox profiles in a particular directory and delete them.""" |
265 for f in os.listdir(directory): | 271 for f in os.listdir(directory): |
266 item = os.path.join(directory, f) | 272 item = os.path.join(directory, f) |
267 if os.path.isdir(item) and (f.startswith('tmp') or f.startswith('opera')): | 273 if os.path.isdir(item) and (f.startswith('tmp') or f.startswith('opera')): |
268 subprocess.Popen('rm -rf %s' % item, shell=True) | 274 subprocess.Popen('rm -rf %s' % item, shell=True) |
269 | 275 |
270 | 276 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 355 |
350 if build_info.csp: test_flags += ['--csp'] | 356 if build_info.csp: test_flags += ['--csp'] |
351 | 357 |
352 if build_info.runtime == 'chromeOnAndroid': | 358 if build_info.runtime == 'chromeOnAndroid': |
353 test_flags.append('--local_ip=%s' % GetLocalIPAddress()) | 359 test_flags.append('--local_ip=%s' % GetLocalIPAddress()) |
354 # test.py expects the android tools directories to be in PATH | 360 # test.py expects the android tools directories to be in PATH |
355 # (they contain for example 'adb') | 361 # (they contain for example 'adb') |
356 AddAndroidToolsToPath() | 362 AddAndroidToolsToPath() |
357 | 363 |
358 TestCompiler(build_info.runtime, build_info.mode, build_info.system, | 364 TestCompiler(build_info.runtime, build_info.mode, build_info.system, |
359 list(test_flags), build_info.is_buildbot, build_info.test_set) | 365 list(test_flags), build_info.is_buildbot, build_info.test_set, |
| 366 build_info.arch) |
360 | 367 |
361 # See comment in GetHasHardCodedCheckedMode, this is a hack. | 368 # See comment in GetHasHardCodedCheckedMode, this is a hack. |
362 if (GetHasHardCodedCheckedMode(build_info)): | 369 if (GetHasHardCodedCheckedMode(build_info)): |
363 TestCompiler(build_info.runtime, build_info.mode, build_info.system, | 370 TestCompiler(build_info.runtime, build_info.mode, build_info.system, |
364 test_flags + ['--checked'], build_info.is_buildbot, | 371 test_flags + ['--checked'], build_info.is_buildbot, |
365 build_info.test_set) | 372 build_info.test_set, build_info.arch) |
366 | 373 |
367 if build_info.runtime != 'd8': | 374 if build_info.runtime != 'd8': |
368 CleanUpTemporaryFiles(build_info.system, build_info.runtime) | 375 CleanUpTemporaryFiles(build_info.system, build_info.runtime) |
369 | 376 |
370 | 377 |
371 def BuildCompiler(build_info): | 378 def BuildCompiler(build_info): |
372 """ | 379 """ |
373 Builds the SDK. | 380 Builds the SDK. |
374 | 381 |
375 - build_info: the buildInfo object, containing information about what sort of | 382 - build_info: the buildInfo object, containing information about what sort of |
376 build and test to be run. | 383 build and test to be run. |
377 """ | 384 """ |
378 with bot.BuildStep('Build SDK and d8'): | 385 with bot.BuildStep('Build SDK and d8'): |
379 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, | 386 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, |
380 'dart2js_bot'] | 387 '--arch=' + build_info.arch, 'dart2js_bot'] |
381 print 'Build SDK and d8: %s' % (' '.join(args)) | 388 print 'Build SDK and d8: %s' % (' '.join(args)) |
382 bot.RunProcess(args) | 389 bot.RunProcess(args) |
383 | 390 |
384 | 391 |
385 if __name__ == '__main__': | 392 if __name__ == '__main__': |
386 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) | 393 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) |
OLD | NEW |