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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 number = None | 55 number = None |
56 if not builder_name: | 56 if not builder_name: |
57 # We are not running on a buildbot. | 57 # We are not running on a buildbot. |
58 if args.name: | 58 if args.name: |
59 builder_name = args.name | 59 builder_name = args.name |
60 else: | 60 else: |
61 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' | 61 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' |
62 sys.exit(1) | 62 sys.exit(1) |
63 | 63 |
64 if builder_name: | 64 if builder_name: |
65 | |
66 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) | 65 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) |
67 frog_pattern = re.match(FROG_BUILDER, builder_name) | 66 frog_pattern = re.match(FROG_BUILDER, builder_name) |
68 web_pattern = re.match(WEB_BUILDER, builder_name) | 67 web_pattern = re.match(WEB_BUILDER, builder_name) |
69 | 68 |
70 if dart2js_pattern: | 69 if dart2js_pattern: |
71 compiler = 'dart2js' | 70 compiler = 'dart2js' |
72 runtime = 'd8' | 71 runtime = 'd8' |
73 system = dart2js_pattern.group(1) | 72 system = dart2js_pattern.group(1) |
74 mode = dart2js_pattern.group(2) | 73 mode = dart2js_pattern.group(2) |
75 option = dart2js_pattern.group(4) | 74 option = dart2js_pattern.group(4) |
76 shard_index = dart2js_pattern.group(5) | 75 shard_index = dart2js_pattern.group(5) |
77 total_shards = dart2js_pattern.group(6) | 76 total_shards = dart2js_pattern.group(6) |
78 | 77 |
79 elif frog_pattern: | 78 elif frog_pattern: |
80 compiler = frog_pattern.group(1) | 79 compiler = frog_pattern.group(1) |
81 runtime = 'd8' | 80 runtime = 'd8' |
82 system = frog_pattern.group(2) | 81 system = frog_pattern.group(2) |
83 mode = frog_pattern.group(3) | 82 mode = frog_pattern.group(3) |
84 | 83 |
85 elif web_pattern: | 84 elif web_pattern: |
86 compiler = 'frog' | 85 compiler = 'dart2js' |
87 runtime = web_pattern.group(1) | 86 runtime = web_pattern.group(1) |
88 mode = 'release' | 87 mode = 'release' |
89 system = web_pattern.group(2) | 88 system = web_pattern.group(2) |
90 | 89 |
91 # TODO(jmesserly): do we want to do anything different for the second IE | 90 # TODO(jmesserly): do we want to do anything different for the second IE |
92 # bot? For now we're using it to track down flakiness. | 91 # bot? For now we're using it to track down flakiness. |
93 number = web_pattern.group(4) | 92 number = web_pattern.group(4) |
94 | 93 |
95 if system == 'windows': | 94 if system == 'windows': |
96 system = 'win7' | 95 system = 'win7' |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 cmd.extend(flags) | 136 cmd.extend(flags) |
138 cmd.extend(targets) | 137 cmd.extend(targets) |
139 | 138 |
140 print 'running %s' % (' '.join(cmd)) | 139 print 'running %s' % (' '.join(cmd)) |
141 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) | 140 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) |
142 if exit_code != 0: | 141 if exit_code != 0: |
143 print '@@@STEP_FAILURE@@@' | 142 print '@@@STEP_FAILURE@@@' |
144 return exit_code | 143 return exit_code |
145 | 144 |
146 | 145 |
147 def BuildFrog(compiler, mode, system): | 146 def BuildCompiler(compiler, mode, system): |
148 """ build frog. | 147 """ build the compiler. |
149 Args: | 148 Args: |
150 - compiler: either 'dart2js' or 'frog' | 149 - compiler: either 'dart2js' or 'frog' |
151 - mode: either 'debug' or 'release' | 150 - mode: either 'debug' or 'release' |
152 - system: either 'linux', 'mac', or 'win7' | 151 - system: either 'linux', 'mac', or 'win7' |
153 """ | 152 """ |
154 # TODO(efortuna): Currently we always clobber Windows builds. The VM | 153 # TODO(efortuna): Currently we always clobber Windows builds. The VM |
155 # team thinks there's a problem with dependency tracking on Windows that | 154 # team thinks there's a problem with dependency tracking on Windows that |
156 # is leading to occasional build failures. Remove when this gyp issue has | 155 # is leading to occasional build failures. Remove when this gyp issue has |
157 # been ironed out. | 156 # been ironed out. |
158 if system == 'win7': | 157 if system == 'win7': |
159 for build in ['Release_', 'Debug_']: | 158 for build in ['Release_', 'Debug_']: |
160 for arch in ['ia32', 'x64']: | 159 for arch in ['ia32', 'x64']: |
161 outdir = build + arch | 160 outdir = build + arch |
162 shutil.rmtree(outdir, ignore_errors=True) | 161 shutil.rmtree(outdir, ignore_errors=True) |
163 shutil.rmtree('frog/%s' % outdir, ignore_errors=True) | 162 shutil.rmtree('frog/%s' % outdir, ignore_errors=True) |
164 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) | 163 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) |
165 | 164 |
166 os.chdir(DART_PATH) | 165 os.chdir(DART_PATH) |
167 | 166 |
168 print '@@@BUILD_STEP build frog@@@' | 167 print '@@@BUILD_STEP build frog@@@' |
169 | 168 |
170 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] | 169 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] |
171 print 'running %s' % (' '.join(args)) | 170 print 'running %s' % (' '.join(args)) |
172 return subprocess.call(args, env=NO_COLOR_ENV) | 171 return subprocess.call(args, env=NO_COLOR_ENV) |
173 | 172 |
174 | 173 |
175 def TestFrog(compiler, runtime, mode, system, option, flags, bot_number=None): | 174 def TestCompiler(compiler, runtime, mode, system, option, flags, bot_number=None
): |
176 """ test frog. | 175 """ test the compiler. |
177 Args: | 176 Args: |
178 - compiler: either 'dart2js' or 'frog' | 177 - compiler: either 'dart2js' or 'frog' |
179 - runtime: either 'd8', or one of the browsers, see GetBuildInfo | 178 - runtime: either 'd8', or one of the browsers, see GetBuildInfo |
180 - mode: either 'debug' or 'release' | 179 - mode: either 'debug' or 'release' |
181 - system: either 'linux', 'mac', or 'win7' | 180 - system: either 'linux', 'mac', or 'win7' |
182 - option: 'checked' | 181 - option: 'checked' |
183 - flags: extra flags to pass to test.dart | 182 - flags: extra flags to pass to test.dart |
184 - bot_number: (optional) Number of the buildbot. Used for dividing test | 183 - bot_number: (optional) Number of the buildbot. Used for dividing test |
185 sets between bots. | 184 sets between bots. |
186 """ | 185 """ |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 compiler, runtime, mode, system, option, shard_index, total_shards, number = ( | 284 compiler, runtime, mode, system, option, shard_index, total_shards, number = ( |
286 GetBuildInfo()) | 285 GetBuildInfo()) |
287 shard_description = "" | 286 shard_description = "" |
288 if shard_index: | 287 if shard_index: |
289 shard_description = " shard %s of %s" % (shard_index, total_shards) | 288 shard_description = " shard %s of %s" % (shard_index, total_shards) |
290 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( | 289 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( |
291 compiler, runtime, mode, system, option, shard_description) | 290 compiler, runtime, mode, system, option, shard_description) |
292 if compiler is None: | 291 if compiler is None: |
293 return 1 | 292 return 1 |
294 | 293 |
295 status = BuildFrog(compiler, mode, system) | 294 status = BuildCompiler(compiler, mode, system) |
296 if status != 0: | 295 if status != 0: |
297 print '@@@STEP_FAILURE@@@' | 296 print '@@@STEP_FAILURE@@@' |
298 return status | 297 return status |
| 298 |
299 test_flags = [] | 299 test_flags = [] |
300 if shard_index: | 300 if shard_index: |
301 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] | 301 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] |
302 if compiler == 'dart2js': | |
303 status = TestFrog(compiler, runtime, mode, system, option, test_flags, | |
304 number) | |
305 if status != 0: | |
306 print '@@@STEP_FAILURE@@@' | |
307 return status # Return unconditionally for dart2js. | |
308 | 302 |
309 if runtime == 'd8' or (system == 'linux' and runtime == 'chrome'): | 303 # First we run all the regular tests. |
310 status = TestFrog(compiler, runtime, mode, system, option, test_flags, | 304 status = TestCompiler(compiler, runtime, mode, system, option, |
311 number) | 305 test_flags, number) |
312 if status != 0: | |
313 print '@@@STEP_FAILURE@@@' | |
314 return status | |
315 | 306 |
316 status = TestFrog(compiler, runtime, mode, system, option, | 307 # BUG(3281): We do not run checked mode tests on dart2js. |
317 test_flags + ['--checked'], number) | 308 if status == 0 and compiler != 'dart2js': |
318 if status != 0: | 309 status = TestCompiler(compiler, runtime, mode, system, option, |
319 print '@@@STEP_FAILURE@@@' | 310 test_flags + ['--checked'], number) |
320 | 311 |
321 if compiler == 'frog' and runtime in ['ff', 'chrome', 'safari', 'opera', | 312 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) |
322 'ie', 'drt']: | 313 if status != 0: print '@@@STEP_FAILURE@@@' |
323 CleanUpTemporaryFiles(system, runtime) | |
324 return status | 314 return status |
325 | 315 |
326 | |
327 if __name__ == '__main__': | 316 if __name__ == '__main__': |
328 sys.exit(main()) | 317 sys.exit(main()) |
OLD | NEW |