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 compiler (running on the vm or the self-hosting version) | 9 Runs tests for the frog or 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 = r'(frog|frogsh)-(linux|mac|windows)-(debug|release)' | 27 FROG_BUILDER = r'(frog)-(linux|mac|windows)-(debug|release)' |
28 WEB_BUILDER = r'web-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)(-(\d+))?' | 28 WEB_BUILDER = r'web-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)(-(\d+))?' |
29 | 29 |
30 NO_COLOR_ENV = dict(os.environ) | 30 NO_COLOR_ENV = dict(os.environ) |
31 NO_COLOR_ENV['TERM'] = 'nocolor' | 31 NO_COLOR_ENV['TERM'] = 'nocolor' |
32 | 32 |
33 def GetBuildInfo(): | 33 def GetBuildInfo(): |
34 """Returns a tuple (compiler, runtime, mode, system, option) where: | 34 """Returns a tuple (compiler, runtime, mode, system, option) where: |
35 - compiler: 'dart2js', 'frog', 'frogsh', or None when the builder has an | 35 - compiler: 'dart2js', 'frog', or None when the builder has an |
36 incorrect name | 36 incorrect name |
37 - runtime: 'd8', 'ie', 'ff', 'safari', 'chrome', 'opera' | 37 - runtime: 'd8', 'ie', 'ff', 'safari', 'chrome', 'opera' |
38 - mode: 'debug' or 'release' | 38 - mode: 'debug' or 'release' |
39 - system: 'linux', 'mac', or 'win7' | 39 - system: 'linux', 'mac', or 'win7' |
40 - option: 'checked' | 40 - option: 'checked' |
41 """ | 41 """ |
42 parser = optparse.OptionParser() | 42 parser = optparse.OptionParser() |
43 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' |
44 '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) |
45 args, _ = parser.parse_args() | 45 args, _ = parser.parse_args() |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (system == 'win7' and platform.system() != 'Windows') or ( | 97 if (system == 'win7' and platform.system() != 'Windows') or ( |
98 system == 'mac' and platform.system() != 'Darwin') or ( | 98 system == 'mac' and platform.system() != 'Darwin') or ( |
99 system == 'linux' and platform.system() != 'Linux'): | 99 system == 'linux' and platform.system() != 'Linux'): |
100 print ('Error: You cannot emulate a buildbot with a platform different ' | 100 print ('Error: You cannot emulate a buildbot with a platform different ' |
101 'from your own.') | 101 'from your own.') |
102 sys.exit(1) | 102 sys.exit(1) |
103 return (compiler, runtime, mode, system, option, shard_index, total_shards) | 103 return (compiler, runtime, mode, system, option, shard_index, total_shards) |
104 | 104 |
105 | 105 |
106 def NeedsXterm(compiler, runtime): | 106 def NeedsXterm(compiler, runtime): |
107 return compiler == 'frogsh' or runtime in ['ie', 'chrome', 'safari', 'opera', | 107 return runtime in ['ie', 'chrome', 'safari', 'opera', 'ff', 'drt'] |
108 'ff', 'drt'] | |
109 | 108 |
110 def TestStep(name, mode, system, compiler, runtime, targets, flags): | 109 def TestStep(name, mode, system, compiler, runtime, targets, flags): |
111 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime, | 110 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime, |
112 ' '.join(flags)) | 111 ' '.join(flags)) |
113 sys.stdout.flush() | 112 sys.stdout.flush() |
114 if NeedsXterm(compiler, runtime) and system == 'linux': | 113 if NeedsXterm(compiler, runtime) and system == 'linux': |
115 cmd = ['xvfb-run', '-a'] | 114 cmd = ['xvfb-run', '-a'] |
116 else: | 115 else: |
117 cmd = [] | 116 cmd = [] |
118 | 117 |
(...skipping 19 matching lines...) Expand all Loading... |
138 print 'running %s' % (' '.join(cmd)) | 137 print 'running %s' % (' '.join(cmd)) |
139 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) | 138 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) |
140 if exit_code != 0: | 139 if exit_code != 0: |
141 print '@@@STEP_FAILURE@@@' | 140 print '@@@STEP_FAILURE@@@' |
142 return exit_code | 141 return exit_code |
143 | 142 |
144 | 143 |
145 def BuildFrog(compiler, mode, system): | 144 def BuildFrog(compiler, mode, system): |
146 """ build frog. | 145 """ build frog. |
147 Args: | 146 Args: |
148 - compiler: either 'dart2js', 'frog', 'frogsh' (frog self-hosted) | 147 - compiler: either 'dart2js' or 'frog' |
149 - mode: either 'debug' or 'release' | 148 - mode: either 'debug' or 'release' |
150 - system: either 'linux', 'mac', or 'win7' | 149 - system: either 'linux', 'mac', or 'win7' |
151 """ | 150 """ |
152 # TODO(efortuna): Currently we always clobber Windows builds. The VM | 151 # TODO(efortuna): Currently we always clobber Windows builds. The VM |
153 # team thinks there's a problem with dependency tracking on Windows that | 152 # team thinks there's a problem with dependency tracking on Windows that |
154 # is leading to occasional build failures. Remove when this gyp issue has | 153 # is leading to occasional build failures. Remove when this gyp issue has |
155 # been ironed out. | 154 # been ironed out. |
156 if system == 'win7': | 155 if system == 'win7': |
157 for build in ['Release_', 'Debug_']: | 156 for build in ['Release_', 'Debug_']: |
158 for arch in ['ia32', 'x64']: | 157 for arch in ['ia32', 'x64']: |
159 outdir = build + arch | 158 outdir = build + arch |
160 shutil.rmtree(outdir, ignore_errors=True) | 159 shutil.rmtree(outdir, ignore_errors=True) |
161 shutil.rmtree('frog/%s' % outdir, ignore_errors=True) | 160 shutil.rmtree('frog/%s' % outdir, ignore_errors=True) |
162 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) | 161 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) |
163 | 162 |
164 os.chdir(DART_PATH) | 163 os.chdir(DART_PATH) |
165 | 164 |
166 print '@@@BUILD_STEP build frog@@@' | 165 print '@@@BUILD_STEP build frog@@@' |
167 | 166 |
168 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'dart2js'] | 167 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'dart2js'] |
169 print 'running %s' % (' '.join(args)) | 168 print 'running %s' % (' '.join(args)) |
170 return subprocess.call(args, env=NO_COLOR_ENV) | 169 return subprocess.call(args, env=NO_COLOR_ENV) |
171 | 170 |
172 | 171 |
173 def TestFrog(compiler, runtime, mode, system, option, flags): | 172 def TestFrog(compiler, runtime, mode, system, option, flags): |
174 """ test frog. | 173 """ test frog. |
175 Args: | 174 Args: |
176 - compiler: either 'dart2js', 'frog', or 'frogsh' (frog self-hosted) | 175 - compiler: either 'dart2js' or 'frog' |
177 - runtime: either 'd8', or one of the browsers, see GetBuildInfo | 176 - runtime: either 'd8', or one of the browsers, see GetBuildInfo |
178 - mode: either 'debug' or 'release' | 177 - mode: either 'debug' or 'release' |
179 - system: either 'linux', 'mac', or 'win7' | 178 - system: either 'linux', 'mac', or 'win7' |
180 - option: 'checked' | 179 - option: 'checked' |
181 - flags: extra flags to pass to test.dart | 180 - flags: extra flags to pass to test.dart |
182 """ | 181 """ |
183 | 182 |
184 # Make sure we are in the frog directory | 183 # Make sure we are in the frog directory |
185 os.chdir(DART_PATH) | 184 os.chdir(DART_PATH) |
186 | 185 |
187 if compiler == 'dart2js': | 186 if compiler == 'dart2js': |
188 if (option == 'checked'): | 187 if (option == 'checked'): |
189 flags.append('--host-checked') | 188 flags.append('--host-checked') |
190 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. | 189 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. |
191 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['leg'], ['--checked']) | 190 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['leg'], ['--checked']) |
192 | 191 |
193 extra_suites = ['leg_only', 'frog_native'] | 192 extra_suites = ['leg_only', 'frog_native'] |
194 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extra_suites, | 193 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extra_suites, |
195 flags) | 194 flags) |
196 | 195 |
197 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) | 196 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) |
198 | 197 |
199 elif runtime == 'd8' and compiler in ['frog', 'frogsh']: | 198 elif runtime == 'd8' and compiler in ['frog']: |
200 TestStep("frog", mode, system, compiler, runtime, [], flags) | 199 TestStep("frog", mode, system, compiler, runtime, [], flags) |
201 TestStep("frog_extra", mode, system, compiler, runtime, | 200 TestStep("frog_extra", mode, system, compiler, runtime, |
202 ['frog', 'frog_native', 'peg', 'css'], flags) | 201 ['frog', 'frog_native', 'peg', 'css'], flags) |
203 TestStep("sdk", mode, system, 'none', 'vm', ['dartdoc'], flags) | 202 TestStep("sdk", mode, system, 'none', 'vm', ['dartdoc'], flags) |
204 | 203 |
205 else: | 204 else: |
206 tests = ['client', 'language', 'corelib', 'isolate', 'frog', | 205 tests = ['client', 'language', 'corelib', 'isolate', 'frog', |
207 'frog_native', 'peg', 'css'] | 206 'frog_native', 'peg', 'css'] |
208 | 207 |
209 # TODO(efortuna): Move Mac back to DumpRenderTree when we have a more stable | 208 # TODO(efortuna): Move Mac back to DumpRenderTree when we have a more stable |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 print '@@@STEP_FAILURE@@@' | 300 print '@@@STEP_FAILURE@@@' |
302 | 301 |
303 if compiler == 'frog' and runtime in ['ff', 'chrome', 'safari', 'opera', | 302 if compiler == 'frog' and runtime in ['ff', 'chrome', 'safari', 'opera', |
304 'ie', 'drt']: | 303 'ie', 'drt']: |
305 CleanUpTemporaryFiles(system, runtime) | 304 CleanUpTemporaryFiles(system, runtime) |
306 return status | 305 return status |
307 | 306 |
308 | 307 |
309 if __name__ == '__main__': | 308 if __name__ == '__main__': |
310 sys.exit(main()) | 309 sys.exit(main()) |
OLD | NEW |