| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 cmd.extend(flags) | 136 cmd.extend(flags) |
| 137 cmd.extend(targets) | 137 cmd.extend(targets) |
| 138 | 138 |
| 139 print 'running %s' % (' '.join(cmd)) | 139 print 'running %s' % (' '.join(cmd)) |
| 140 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) | 140 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) |
| 141 if exit_code != 0: | 141 if exit_code != 0: |
| 142 print '@@@STEP_FAILURE@@@' | 142 print '@@@STEP_FAILURE@@@' |
| 143 return exit_code | 143 return exit_code |
| 144 | 144 |
| 145 | 145 |
| 146 def BuildCompiler(compiler, mode, system): | 146 def BuildSDK(mode, system): |
| 147 """ build the compiler. | 147 """ build the SDK. |
| 148 Args: | 148 Args: |
| 149 - compiler: either 'dart2js' or 'frog' | |
| 150 - mode: either 'debug' or 'release' | 149 - mode: either 'debug' or 'release' |
| 151 - system: either 'linux', 'mac', or 'win7' | 150 - system: either 'linux', 'mac', or 'win7' |
| 152 """ | 151 """ |
| 153 # TODO(efortuna): Currently we always clobber Windows builds. The VM | 152 # TODO(efortuna): Currently we always clobber Windows builds. The VM |
| 154 # team thinks there's a problem with dependency tracking on Windows that | 153 # 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 | 154 # is leading to occasional build failures. Remove when this gyp issue has |
| 156 # been ironed out. | 155 # been ironed out. |
| 157 if system == 'win7': | 156 if system == 'win7': |
| 158 for build in ['Release_', 'Debug_']: | 157 for build in ['Release_', 'Debug_']: |
| 159 for arch in ['ia32', 'x64']: | 158 for arch in ['ia32', 'x64']: |
| 160 outdir = build + arch | 159 outdir = build + arch |
| 161 shutil.rmtree(outdir, ignore_errors=True) | 160 shutil.rmtree(outdir, ignore_errors=True) |
| 162 shutil.rmtree('frog/%s' % outdir, ignore_errors=True) | 161 shutil.rmtree('frog/%s' % outdir, ignore_errors=True) |
| 163 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) | 162 shutil.rmtree('runtime/%s' % outdir, ignore_errors=True) |
| 164 | 163 |
| 165 os.chdir(DART_PATH) | 164 os.chdir(DART_PATH) |
| 166 | 165 |
| 167 print '@@@BUILD_STEP build frog@@@' | 166 print '@@@BUILD_STEP build sdk@@@' |
| 168 | 167 |
| 169 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] | 168 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] |
| 170 print 'running %s' % (' '.join(args)) | 169 print 'running %s' % (' '.join(args)) |
| 171 return subprocess.call(args, env=NO_COLOR_ENV) | 170 return subprocess.call(args, env=NO_COLOR_ENV) |
| 172 | 171 |
| 173 | 172 |
| 174 def TestCompiler(compiler, runtime, mode, system, option, flags, bot_number=None
): | 173 def TestCompiler(compiler, runtime, mode, system, option, flags, bot_number=None
): |
| 175 """ test the compiler. | 174 """ test the compiler. |
| 176 Args: | 175 Args: |
| 177 - compiler: either 'dart2js' or 'frog' | 176 - compiler: either 'dart2js' or 'frog' |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 compiler, runtime, mode, system, option, shard_index, total_shards, number = ( | 283 compiler, runtime, mode, system, option, shard_index, total_shards, number = ( |
| 285 GetBuildInfo()) | 284 GetBuildInfo()) |
| 286 shard_description = "" | 285 shard_description = "" |
| 287 if shard_index: | 286 if shard_index: |
| 288 shard_description = " shard %s of %s" % (shard_index, total_shards) | 287 shard_description = " shard %s of %s" % (shard_index, total_shards) |
| 289 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( | 288 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s%s" % ( |
| 290 compiler, runtime, mode, system, option, shard_description) | 289 compiler, runtime, mode, system, option, shard_description) |
| 291 if compiler is None: | 290 if compiler is None: |
| 292 return 1 | 291 return 1 |
| 293 | 292 |
| 294 status = BuildCompiler(compiler, mode, system) | 293 status = BuildSDK(mode, system) |
| 295 if status != 0: | 294 if status != 0: |
| 296 print '@@@STEP_FAILURE@@@' | 295 print '@@@STEP_FAILURE@@@' |
| 297 return status | 296 return status |
| 298 | 297 |
| 299 test_flags = [] | 298 test_flags = [] |
| 300 if shard_index: | 299 if shard_index: |
| 301 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] | 300 test_flags = ['--shards=%s' % total_shards, '--shard=%s' % shard_index] |
| 302 | 301 |
| 303 # First we run all the regular tests. | 302 # First we run all the regular tests. |
| 304 status = TestCompiler(compiler, runtime, mode, system, option, | 303 status = TestCompiler(compiler, runtime, mode, system, option, |
| 305 test_flags, number) | 304 test_flags, number) |
| 306 | 305 |
| 307 # BUG(3281): We do not run checked mode tests on dart2js. | 306 # BUG(3281): We do not run checked mode tests on dart2js. |
| 308 if status == 0 and compiler != 'dart2js': | 307 if status == 0 and compiler != 'dart2js': |
| 309 status = TestCompiler(compiler, runtime, mode, system, option, | 308 status = TestCompiler(compiler, runtime, mode, system, option, |
| 310 test_flags + ['--checked'], number) | 309 test_flags + ['--checked'], number) |
| 311 | 310 |
| 312 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) | 311 if runtime != 'd8': CleanUpTemporaryFiles(system, runtime) |
| 313 if status != 0: print '@@@STEP_FAILURE@@@' | 312 if status != 0: print '@@@STEP_FAILURE@@@' |
| 314 return status | 313 return status |
| 315 | 314 |
| 316 if __name__ == '__main__': | 315 if __name__ == '__main__': |
| 317 sys.exit(main()) | 316 sys.exit(main()) |
| OLD | NEW |