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 """Dart2js buildbot steps |
8 | 8 |
9 Runs tests for the frog or dart2js compiler. | 9 Runs tests for the dart2js compiler. |
10 """ | 10 """ |
11 | 11 |
12 import platform | 12 import platform |
13 import optparse | 13 import optparse |
14 import os | 14 import os |
15 import re | 15 import re |
16 import shutil | 16 import shutil |
17 import subprocess | 17 import subprocess |
18 import sys | 18 import sys |
19 | 19 |
20 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' | 20 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' |
21 | 21 |
22 DART_PATH = os.path.dirname( | 22 DART_PATH = os.path.dirname( |
23 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 23 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
24 | 24 |
25 DART2JS_BUILDER = ( | 25 DART2JS_BUILDER = ( |
26 r'dart2js-(linux|mac|windows)-(debug|release)(-([a-z]+))?-?(\d*)-?(\d*)') | 26 r'dart2js-(linux|mac|windows)-(debug|release)(-([a-z]+))?-?(\d*)-?(\d*)') |
27 FROG_BUILDER = ( | |
28 r'(frog)-(linux|mac|windows)-(debug|release)') | |
29 WEB_BUILDER = ( | 27 WEB_BUILDER = ( |
30 r'web-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)-?(\d*)-?(\d*)') | 28 r'web-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)-?(\d*)-?(\d*)') |
31 | 29 |
32 NO_COLOR_ENV = dict(os.environ) | 30 NO_COLOR_ENV = dict(os.environ) |
33 NO_COLOR_ENV['TERM'] = 'nocolor' | 31 NO_COLOR_ENV['TERM'] = 'nocolor' |
34 | 32 |
35 def GetBuildInfo(): | 33 def GetBuildInfo(): |
36 """Returns a tuple (compiler, runtime, mode, system, option) where: | 34 """Returns a tuple (compiler, runtime, mode, system, option) where: |
37 - compiler: 'dart2js', 'frog', or None when the builder has an | 35 - compiler: 'dart2js' or None when the builder has an |
kasperl
2012/08/14 07:05:44
Does the "- compiler" comment fit on one line now?
ricow1
2012/08/14 07:41:14
Yes
| |
38 incorrect name | 36 incorrect name |
39 - runtime: 'd8', 'ie', 'ff', 'safari', 'chrome', 'opera' | 37 - runtime: 'd8', 'ie', 'ff', 'safari', 'chrome', 'opera' |
40 - mode: 'debug' or 'release' | 38 - mode: 'debug' or 'release' |
41 - system: 'linux', 'mac', or 'win7' | 39 - system: 'linux', 'mac', or 'win7' |
42 - option: 'checked' | 40 - option: 'checked' |
43 """ | 41 """ |
44 parser = optparse.OptionParser() | 42 parser = optparse.OptionParser() |
45 parser.add_option('-n', '--name', dest='name', help='The name of the build' | 43 parser.add_option('-n', '--name', dest='name', help='The name of the build' |
46 'bot you would like to emulate (ex: web-chrome-win7)', default=None) | 44 'bot you would like to emulate (ex: web-chrome-win7)', default=None) |
47 args, _ = parser.parse_args() | 45 args, _ = parser.parse_args() |
(...skipping 11 matching lines...) Expand all Loading... | |
59 # We are not running on a buildbot. | 57 # We are not running on a buildbot. |
60 is_buildbot = False | 58 is_buildbot = False |
61 if args.name: | 59 if args.name: |
62 builder_name = args.name | 60 builder_name = args.name |
63 else: | 61 else: |
64 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' | 62 print 'Use -n $BUILDBOT_NAME for the bot you would like to emulate.' |
65 sys.exit(1) | 63 sys.exit(1) |
66 | 64 |
67 if builder_name: | 65 if builder_name: |
68 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) | 66 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) |
69 frog_pattern = re.match(FROG_BUILDER, builder_name) | |
70 web_pattern = re.match(WEB_BUILDER, builder_name) | 67 web_pattern = re.match(WEB_BUILDER, builder_name) |
71 | 68 |
72 if dart2js_pattern: | 69 if dart2js_pattern: |
73 compiler = 'dart2js' | 70 compiler = 'dart2js' |
74 runtime = 'd8' | 71 runtime = 'd8' |
75 system = dart2js_pattern.group(1) | 72 system = dart2js_pattern.group(1) |
76 mode = dart2js_pattern.group(2) | 73 mode = dart2js_pattern.group(2) |
77 option = dart2js_pattern.group(4) | 74 option = dart2js_pattern.group(4) |
78 shard_index = dart2js_pattern.group(5) | 75 shard_index = dart2js_pattern.group(5) |
79 total_shards = dart2js_pattern.group(6) | 76 total_shards = dart2js_pattern.group(6) |
80 | 77 |
81 elif frog_pattern: | |
82 compiler = frog_pattern.group(1) | |
83 runtime = 'd8' | |
84 system = frog_pattern.group(2) | |
85 mode = frog_pattern.group(3) | |
86 | |
87 elif web_pattern: | 78 elif web_pattern: |
88 compiler = 'dart2js' | 79 compiler = 'dart2js' |
89 runtime = web_pattern.group(1) | 80 runtime = web_pattern.group(1) |
90 system = web_pattern.group(2) | 81 system = web_pattern.group(2) |
91 mode = 'release' | 82 mode = 'release' |
92 shard_index = web_pattern.group(3) | 83 shard_index = web_pattern.group(3) |
93 total_shards = web_pattern.group(4) | 84 total_shards = web_pattern.group(4) |
94 | 85 |
95 if system == 'windows': | 86 if system == 'windows': |
96 system = 'win7' | 87 system = 'win7' |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 """ | 143 """ |
153 # TODO(efortuna): Currently we always clobber Windows builds. The VM | 144 # TODO(efortuna): Currently we always clobber Windows builds. The VM |
154 # team thinks there's a problem with dependency tracking on Windows that | 145 # team thinks there's a problem with dependency tracking on Windows that |
155 # is leading to occasional build failures. Remove when this gyp issue has | 146 # is leading to occasional build failures. Remove when this gyp issue has |
156 # been ironed out. | 147 # been ironed out. |
157 if system == 'win7': | 148 if system == 'win7': |
158 for build in ['Release_', 'Debug_']: | 149 for build in ['Release_', 'Debug_']: |
159 for arch in ['ia32', 'x64']: | 150 for arch in ['ia32', 'x64']: |
160 outdir = build + arch | 151 outdir = build + arch |
161 shutil.rmtree(outdir, ignore_errors=True) | 152 shutil.rmtree(outdir, ignore_errors=True) |
162 shutil.rmtree('frog/%s' % outdir, ignore_errors=True) | |
163 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) | 153 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) |
164 | 154 |
165 os.chdir(DART_PATH) | 155 os.chdir(DART_PATH) |
166 | 156 |
167 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] | 157 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] |
168 print 'running %s' % (' '.join(args)) | 158 print 'running %s' % (' '.join(args)) |
169 return subprocess.call(args, env=NO_COLOR_ENV) | 159 return subprocess.call(args, env=NO_COLOR_ENV) |
170 | 160 |
171 | 161 |
172 def TestCompiler(compiler, runtime, mode, system, option, flags, is_buildbot): | 162 def TestCompiler(compiler, runtime, mode, system, option, flags, is_buildbot): |
kasperl
2012/08/14 07:05:44
Could we get rid of the compiler parameter?
ricow1
2012/08/14 07:41:14
done
| |
173 """ test the compiler. | 163 """ test the compiler. |
174 Args: | 164 Args: |
175 - compiler: either 'dart2js' or 'frog' | 165 - compiler: 'dart2js' |
176 - runtime: either 'd8', or one of the browsers, see GetBuildInfo | 166 - runtime: either 'd8', or one of the browsers, see GetBuildInfo |
177 - mode: either 'debug' or 'release' | 167 - mode: either 'debug' or 'release' |
178 - system: either 'linux', 'mac', or 'win7' | 168 - system: either 'linux', 'mac', or 'win7' |
179 - option: 'checked' | 169 - option: 'checked' |
180 - flags: extra flags to pass to test.dart | 170 - flags: extra flags to pass to test.dart |
181 - is_buildbot: true if we are running on a real buildbot instead of | 171 - is_buildbot: true if we are running on a real buildbot instead of |
182 emulating one. | 172 emulating one. |
183 """ | 173 """ |
184 | 174 |
185 # Make sure we are in the frog directory | 175 # Make sure we are in the dart directory |
186 os.chdir(DART_PATH) | 176 os.chdir(DART_PATH) |
187 | 177 |
188 if system.startswith('win') and runtime == 'ie': | 178 if system.startswith('win') and runtime == 'ie': |
189 # We don't do proper sharding on the IE bots, since the runtime is | 179 # We don't do proper sharding on the IE bots, since the runtime is |
190 # long for both. We have a "fast bot" and a "slow bot" that run specific | 180 # long for both. We have a "fast bot" and a "slow bot" that run specific |
191 # tests instead. | 181 # tests instead. |
192 for i in flags: | 182 for i in flags: |
193 if i.startswith('--shard='): | 183 if i.startswith('--shard='): |
194 bot_num = i.split('=')[1] | 184 bot_num = i.split('=')[1] |
195 # There should not be more than one InternetExplorerDriver instance | 185 # There should not be more than one InternetExplorerDriver instance |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 TestStep("dart2js", mode, system, 'dart2js', runtime, ['html'], flags) | 250 TestStep("dart2js", mode, system, 'dart2js', runtime, ['html'], flags) |
261 else: | 251 else: |
262 TestStep("dart2js", mode, system, 'dart2js', runtime, ['dartc', | 252 TestStep("dart2js", mode, system, 'dart2js', runtime, ['dartc', |
263 'samples', 'standalone', 'corelib', 'co19', 'language', 'isolate', | 253 'samples', 'standalone', 'corelib', 'co19', 'language', 'isolate', |
264 'vm', 'json', 'benchmark_smoke', 'dartdoc', 'utils', 'pub', 'lib'], | 254 'vm', 'json', 'benchmark_smoke', 'dartdoc', 'utils', 'pub', 'lib'], |
265 flags) | 255 flags) |
266 extras = ['dart2js_extra', 'dart2js_native'] | 256 extras = ['dart2js_extra', 'dart2js_native'] |
267 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extras, | 257 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extras, |
268 flags) | 258 flags) |
269 | 259 |
270 elif compiler == 'frog': | |
271 TestStep("frog", mode, system, compiler, runtime, [], flags) | |
272 extras = ['frog', 'dart2js_native', 'peg', 'css'] | |
273 TestStep("frog_extra", mode, system, compiler, runtime, extras, flags) | |
274 | |
275 return 0 | 260 return 0 |
276 | 261 |
277 def _DeleteFirefoxProfiles(directory): | 262 def _DeleteFirefoxProfiles(directory): |
278 """Find all the firefox profiles in a particular directory and delete them.""" | 263 """Find all the firefox profiles in a particular directory and delete them.""" |
279 for f in os.listdir(directory): | 264 for f in os.listdir(directory): |
280 item = os.path.join(directory, f) | 265 item = os.path.join(directory, f) |
281 if os.path.isdir(item) and f.startswith('tmp'): | 266 if os.path.isdir(item) and f.startswith('tmp'): |
282 subprocess.Popen('rm -rf %s' % item, shell=True) | 267 subprocess.Popen('rm -rf %s' % item, shell=True) |
283 | 268 |
284 def CleanUpTemporaryFiles(system, browser): | 269 def CleanUpTemporaryFiles(system, browser): |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 if status == 0 and option != 'checked' and runtime == 'd8': | 328 if status == 0 and option != 'checked' and runtime == 'd8': |
344 status = TestCompiler(compiler, runtime, mode, system, option, | 329 status = TestCompiler(compiler, runtime, mode, system, option, |
345 test_flags + ['--checked'], is_buildbot) | 330 test_flags + ['--checked'], is_buildbot) |
346 | 331 |
347 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) | 332 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) |
348 if status != 0: print '@@@STEP_FAILURE@@@' | 333 if status != 0: print '@@@STEP_FAILURE@@@' |
349 return status | 334 return status |
350 | 335 |
351 if __name__ == '__main__': | 336 if __name__ == '__main__': |
352 sys.exit(main()) | 337 sys.exit(main()) |
OLD | NEW |