OLD | NEW |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 args, _ = parser.parse_args() | 45 args, _ = parser.parse_args() |
46 | 46 |
47 compiler = None | 47 compiler = None |
48 runtime = None | 48 runtime = None |
49 mode = None | 49 mode = None |
50 system = None | 50 system = None |
51 builder_name = os.environ.get(BUILDER_NAME) | 51 builder_name = os.environ.get(BUILDER_NAME) |
52 option = None | 52 option = None |
53 shard_index = None | 53 shard_index = None |
54 total_shards = None | 54 total_shards = None |
55 number = None | |
56 if not builder_name: | 55 if not builder_name: |
57 # We are not running on a buildbot. | 56 # We are not running on a buildbot. |
58 if args.name: | 57 if args.name: |
59 builder_name = args.name | 58 builder_name = args.name |
60 else: | 59 else: |
61 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' | 60 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' |
62 sys.exit(1) | 61 sys.exit(1) |
63 | 62 |
64 if builder_name: | 63 if builder_name: |
65 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) | 64 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) |
(...skipping 14 matching lines...) Expand all Loading... |
80 runtime = 'd8' | 79 runtime = 'd8' |
81 system = frog_pattern.group(2) | 80 system = frog_pattern.group(2) |
82 mode = frog_pattern.group(3) | 81 mode = frog_pattern.group(3) |
83 | 82 |
84 elif web_pattern: | 83 elif web_pattern: |
85 compiler = 'dart2js' | 84 compiler = 'dart2js' |
86 runtime = web_pattern.group(1) | 85 runtime = web_pattern.group(1) |
87 mode = 'release' | 86 mode = 'release' |
88 system = web_pattern.group(2) | 87 system = web_pattern.group(2) |
89 | 88 |
90 # TODO(jmesserly): do we want to do anything different for the second IE | 89 # TODO(kasperl): Update the names of the web builders so we can |
91 # bot? For now we're using it to track down flakiness. | 90 # use the generic sharding mechanism. |
92 number = web_pattern.group(4) | 91 if (runtime == 'ie'): |
| 92 total_shards = 2 |
| 93 if web_pattern.group(4) == '2': shard_index = 2 |
| 94 else: shard_index = 1 |
93 | 95 |
94 if system == 'windows': | 96 if system == 'windows': |
95 system = 'win7' | 97 system = 'win7' |
96 | 98 |
97 if (system == 'win7' and platform.system() != 'Windows') or ( | 99 if (system == 'win7' and platform.system() != 'Windows') or ( |
98 system == 'mac' and platform.system() != 'Darwin') or ( | 100 system == 'mac' and platform.system() != 'Darwin') or ( |
99 system == 'linux' and platform.system() != 'Linux'): | 101 system == 'linux' and platform.system() != 'Linux'): |
100 print ('Error: You cannot emulate a buildbot with a platform different ' | 102 print ('Error: You cannot emulate a buildbot with a platform different ' |
101 'from your own.') | 103 'from your own.') |
102 sys.exit(1) | 104 sys.exit(1) |
103 return (compiler, runtime, mode, system, option, shard_index, total_shards, | 105 return (compiler, runtime, mode, system, option, shard_index, total_shards) |
104 number) | |
105 | 106 |
106 | 107 |
107 def NeedsXterm(compiler, runtime): | 108 def NeedsXterm(compiler, runtime): |
108 return runtime in ['ie', 'chrome', 'safari', 'opera', 'ff', 'drt'] | 109 return runtime in ['ie', 'chrome', 'safari', 'opera', 'ff', 'drt'] |
109 | 110 |
110 def TestStep(name, mode, system, compiler, runtime, targets, flags): | 111 def TestStep(name, mode, system, compiler, runtime, targets, flags): |
111 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime, | 112 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime, |
112 ' '.join(flags)) | 113 ' '.join(flags)) |
113 sys.stdout.flush() | 114 sys.stdout.flush() |
114 if NeedsXterm(compiler, runtime) and system == 'linux': | 115 if NeedsXterm(compiler, runtime) and system == 'linux': |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 164 |
164 os.chdir(DART_PATH) | 165 os.chdir(DART_PATH) |
165 | 166 |
166 print '@@@BUILD_STEP build sdk@@@' | 167 print '@@@BUILD_STEP build sdk@@@' |
167 | 168 |
168 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] | 169 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] |
169 print 'running %s' % (' '.join(args)) | 170 print 'running %s' % (' '.join(args)) |
170 return subprocess.call(args, env=NO_COLOR_ENV) | 171 return subprocess.call(args, env=NO_COLOR_ENV) |
171 | 172 |
172 | 173 |
173 def TestCompiler(compiler, runtime, mode, system, option, flags, bot_number=None
): | 174 def TestCompiler(compiler, runtime, mode, system, option, flags): |
174 """ test the compiler. | 175 """ test the compiler. |
175 Args: | 176 Args: |
176 - compiler: either 'dart2js' or 'frog' | 177 - compiler: either 'dart2js' or 'frog' |
177 - runtime: either 'd8', or one of the browsers, see GetBuildInfo | 178 - runtime: either 'd8', or one of the browsers, see GetBuildInfo |
178 - mode: either 'debug' or 'release' | 179 - mode: either 'debug' or 'release' |
179 - system: either 'linux', 'mac', or 'win7' | 180 - system: either 'linux', 'mac', or 'win7' |
180 - option: 'checked' | 181 - option: 'checked' |
181 - flags: extra flags to pass to test.dart | 182 - flags: extra flags to pass to test.dart |
182 - bot_number: (optional) Number of the buildbot. Used for dividing test | |
183 sets between bots. | |
184 """ | 183 """ |
185 | 184 |
186 # Make sure we are in the frog directory | 185 # Make sure we are in the frog directory |
187 os.chdir(DART_PATH) | 186 os.chdir(DART_PATH) |
188 | 187 |
| 188 if system.startswith('win') and runtime == 'ie': |
| 189 # There should not be more than one InternetExplorerDriver instance |
| 190 # running at a time. For details, see |
| 191 # http://code.google.com/p/selenium/wiki/InternetExplorerDriver. |
| 192 flags = flags + ['-j1'] |
| 193 |
189 if compiler == 'dart2js': | 194 if compiler == 'dart2js': |
190 if (option == 'checked'): | 195 if (option == 'checked'): flags = flags + ['--host-checked'] |
191 flags.append('--host-checked') | |
192 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. | 196 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. |
193 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['leg'], ['--checked']) | 197 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['leg'], ['--checked']) |
194 | 198 |
195 extra_suites = ['leg_only', 'frog_native'] | 199 extra_suites = ['leg_only', 'frog_native'] |
196 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extra_suites, | 200 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extra_suites, |
197 flags) | 201 flags) |
198 | 202 |
199 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) | 203 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) |
200 | 204 |
201 elif runtime == 'd8' and compiler in ['frog']: | 205 elif runtime == 'd8' and compiler in ['frog']: |
(...skipping 14 matching lines...) Expand all Loading... |
216 TestStep('browser', mode, system, 'frog', 'drt', tests, flags) | 220 TestStep('browser', mode, system, 'frog', 'drt', tests, flags) |
217 | 221 |
218 # TODO(ngeoffray): Enable checked mode once dart2js supports type | 222 # TODO(ngeoffray): Enable checked mode once dart2js supports type |
219 # variables. | 223 # variables. |
220 if not ('--checked' in flags): | 224 if not ('--checked' in flags): |
221 TestStep('browser_dart2js', mode, system, 'dart2js', 'drt', [], flags) | 225 TestStep('browser_dart2js', mode, system, 'dart2js', 'drt', [], flags) |
222 TestStep('browser_dart2js_extra', mode, system, 'dart2js', 'drt', | 226 TestStep('browser_dart2js_extra', mode, system, 'dart2js', 'drt', |
223 ['leg_only', 'frog_native'], flags) | 227 ['leg_only', 'frog_native'], flags) |
224 | 228 |
225 else: | 229 else: |
226 additional_flags = [] | 230 TestStep(runtime, mode, system, compiler, runtime, tests, flags) |
227 if system.startswith('win') and runtime == 'ie': | |
228 # There should not be more than one InternetExplorerDriver instance | |
229 # running at a time. For details, see | |
230 # http://code.google.com/p/selenium/wiki/InternetExplorerDriver. | |
231 additional_flags += ['-j1'] | |
232 # The IE bots are slow lately. Split up the tests they do. | |
233 if bot_number == '2': | |
234 tests = ['language'] | |
235 else: | |
236 tests = ['dom', 'html', 'json', 'benchmark_smoke', | |
237 'isolate', 'frog', 'css', 'frog_native', 'peg', 'corelib'] | |
238 TestStep(runtime, mode, system, compiler, runtime, tests, | |
239 flags + additional_flags) | |
240 | 231 |
241 return 0 | 232 return 0 |
242 | 233 |
243 def _DeleteFirefoxProfiles(directory): | 234 def _DeleteFirefoxProfiles(directory): |
244 """Find all the firefox profiles in a particular directory and delete them.""" | 235 """Find all the firefox profiles in a particular directory and delete them.""" |
245 for f in os.listdir(directory): | 236 for f in os.listdir(directory): |
246 item = os.path.join(directory, f) | 237 item = os.path.join(directory, f) |
247 if os.path.isdir(item) and f.startswith('tmp'): | 238 if os.path.isdir(item) and f.startswith('tmp'): |
248 subprocess.Popen('rm -rf %s' % item, shell=True) | 239 subprocess.Popen('rm -rf %s' % item, shell=True) |
249 | 240 |
(...skipping 23 matching lines...) Expand all Loading... |
273 # password. The command won't actually work on regular machines without | 264 # password. The command won't actually work on regular machines without |
274 # root permissions. | 265 # root permissions. |
275 _DeleteFirefoxProfiles('/tmp') | 266 _DeleteFirefoxProfiles('/tmp') |
276 _DeleteFirefoxProfiles('/var/tmp') | 267 _DeleteFirefoxProfiles('/var/tmp') |
277 | 268 |
278 def main(): | 269 def main(): |
279 if len(sys.argv) == 0: | 270 if len(sys.argv) == 0: |
280 print 'Script pathname not known, giving up.' | 271 print 'Script pathname not known, giving up.' |
281 return 1 | 272 return 1 |
282 | 273 |
283 compiler, runtime, mode, system, option, shard_index, total_shards, number = ( | 274 compiler, runtime, mode, system, option, shard_index, total_shards = ( |
284 GetBuildInfo()) | 275 GetBuildInfo()) |
285 shard_description = "" | 276 shard_description = "" |
286 if shard_index: | 277 if shard_index: |
287 shard_description = " shard %s of %s" % (shard_index, total_shards) | 278 shard_description = " shard %s of %s" % (shard_index, total_shards) |
288 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( | 279 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( |
289 compiler, runtime, mode, system, option, shard_description) | 280 compiler, runtime, mode, system, option, shard_description) |
290 if compiler is None: | 281 if compiler is None: |
291 return 1 | 282 return 1 |
292 | 283 |
293 status = BuildSDK(mode, system) | 284 status = BuildSDK(mode, system) |
294 if status != 0: | 285 if status != 0: |
295 print '@@@STEP_FAILURE@@@' | 286 print '@@@STEP_FAILURE@@@' |
296 return status | 287 return status |
297 | 288 |
298 test_flags = [] | 289 test_flags = [] |
299 if shard_index: | 290 if shard_index: |
300 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] | 291 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] |
301 | 292 |
302 # First we run all the regular tests. | 293 # First we run all the regular tests. |
303 status = TestCompiler(compiler, runtime, mode, system, option, | 294 status = TestCompiler(compiler, runtime, mode, system, option, test_flags) |
304 test_flags, number) | |
305 | 295 |
306 # BUG(3281): We do not run checked mode tests on dart2js. | 296 # BUG(3281): We do not run checked mode tests on dart2js. |
307 if status == 0 and compiler != 'dart2js': | 297 if status == 0 and compiler != 'dart2js': |
308 status = TestCompiler(compiler, runtime, mode, system, option, | 298 status = TestCompiler(compiler, runtime, mode, system, option, |
309 test_flags + ['--checked'], number) | 299 test_flags + ['--checked']) |
310 | 300 |
311 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) | 301 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) |
312 if status != 0: print '@@@STEP_FAILURE@@@' | 302 if status != 0: print '@@@STEP_FAILURE@@@' |
313 return status | 303 return status |
314 | 304 |
315 if __name__ == '__main__': | 305 if __name__ == '__main__': |
316 sys.exit(main()) | 306 sys.exit(main()) |
OLD | NEW |