| 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 """ | 7 """ |
| 8 Dart2js buildbot steps | 8 Dart2js buildbot steps |
| 9 | 9 |
| 10 Runs tests for the dart2js compiler. | 10 Runs tests for the dart2js compiler. |
| 11 """ | 11 """ |
| 12 | 12 |
| 13 import platform | 13 import platform |
| 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 import bot | 20 import bot |
| 21 | 21 |
| 22 DART2JS_BUILDER = ( | 22 DART2JS_BUILDER = ( |
| 23 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch
ecked))?(-(host-checked))?-?(\d*)-?(\d*)') | 23 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch
ecked))?(-(host-checked))?(-(minify))?-?(\d*)-?(\d*)') |
| 24 WEB_BUILDER = ( | 24 WEB_BUILDER = ( |
| 25 r'dart2js-(ie9|ie10|ff|safari|chrome|opera)-(win7|win8|mac|linux)(-(all|html
))?') | 25 r'dart2js-(ie9|ie10|ff|safari|chrome|opera)-(win7|win8|mac|linux)(-(all|html
))?') |
| 26 | 26 |
| 27 | 27 |
| 28 def GetBuildInfo(builder_name, is_buildbot): | 28 def GetBuildInfo(builder_name, is_buildbot): |
| 29 """Returns a BuildInfo object for the current buildbot based on the | 29 """Returns a BuildInfo object for the current buildbot based on the |
| 30 name of the builder. | 30 name of the builder. |
| 31 """ | 31 """ |
| 32 compiler = None | 32 compiler = None |
| 33 runtime = None | 33 runtime = None |
| 34 mode = None | 34 mode = None |
| 35 system = None | 35 system = None |
| 36 checked = False | 36 checked = False |
| 37 host_checked = False | 37 host_checked = False |
| 38 minify = False |
| 38 shard_index = None | 39 shard_index = None |
| 39 total_shards = None | 40 total_shards = None |
| 40 test_set = None | 41 test_set = None |
| 41 | 42 |
| 42 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) | 43 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) |
| 43 web_pattern = re.match(WEB_BUILDER, builder_name) | 44 web_pattern = re.match(WEB_BUILDER, builder_name) |
| 44 | 45 |
| 45 if web_pattern: | 46 if web_pattern: |
| 46 compiler = 'dart2js' | 47 compiler = 'dart2js' |
| 47 runtime = web_pattern.group(1) | 48 runtime = web_pattern.group(1) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 59 # Empty: checked=False, host_checked=False | 60 # Empty: checked=False, host_checked=False |
| 60 # -checked: checked=True, host_checked=False | 61 # -checked: checked=True, host_checked=False |
| 61 # -host-checked: checked=False, host_checked=True | 62 # -host-checked: checked=False, host_checked=True |
| 62 # -checked-host-checked: checked=True, host_checked=True | 63 # -checked-host-checked: checked=True, host_checked=True |
| 63 if dart2js_pattern.group(6) == 'checked': | 64 if dart2js_pattern.group(6) == 'checked': |
| 64 checked = True | 65 checked = True |
| 65 if dart2js_pattern.group(6) == 'host-checked': | 66 if dart2js_pattern.group(6) == 'host-checked': |
| 66 host_checked = True | 67 host_checked = True |
| 67 if dart2js_pattern.group(8) == 'host-checked': | 68 if dart2js_pattern.group(8) == 'host-checked': |
| 68 host_checked = True | 69 host_checked = True |
| 69 shard_index = dart2js_pattern.group(9) | 70 if dart2js_pattern.group(10) == 'minify': |
| 70 total_shards = dart2js_pattern.group(10) | 71 minify = True |
| 72 shard_index = dart2js_pattern.group(11) |
| 73 total_shards = dart2js_pattern.group(12) |
| 71 else : | 74 else : |
| 72 return None | 75 return None |
| 73 | 76 |
| 74 if system == 'windows': | 77 if system == 'windows': |
| 75 system = 'win7' | 78 system = 'win7' |
| 76 | 79 |
| 77 if (system == 'win7' and platform.system() != 'Windows') or ( | 80 if (system == 'win7' and platform.system() != 'Windows') or ( |
| 78 system == 'mac' and platform.system() != 'Darwin') or ( | 81 system == 'mac' and platform.system() != 'Darwin') or ( |
| 79 system == 'linux' and platform.system() != 'Linux'): | 82 system == 'linux' and platform.system() != 'Linux'): |
| 80 print ('Error: You cannot emulate a buildbot with a platform different ' | 83 print ('Error: You cannot emulate a buildbot with a platform different ' |
| 81 'from your own.') | 84 'from your own.') |
| 82 return None | 85 return None |
| 83 | 86 |
| 84 return bot.BuildInfo(compiler, runtime, mode, system, checked, host_checked, | 87 return bot.BuildInfo(compiler, runtime, mode, system, checked, host_checked, |
| 85 shard_index, total_shards, is_buildbot, test_set) | 88 minify, shard_index, total_shards, is_buildbot, |
| 89 test_set) |
| 86 | 90 |
| 87 | 91 |
| 88 def NeedsXterm(compiler, runtime): | 92 def NeedsXterm(compiler, runtime): |
| 89 return runtime in ['ie9', 'ie10', 'chrome', 'safari', 'opera', 'ff', 'drt'] | 93 return runtime in ['ie9', 'ie10', 'chrome', 'safari', 'opera', 'ff', 'drt'] |
| 90 | 94 |
| 91 | 95 |
| 92 def TestStepName(name, flags): | 96 def TestStepName(name, flags): |
| 93 # Filter out flags with '=' as this breaks the /stats feature of the | 97 # Filter out flags with '=' as this breaks the /stats feature of the |
| 94 # build bot. | 98 # build bot. |
| 95 flags = [x for x in flags if not '=' in x] | 99 flags = [x for x in flags if not '=' in x] |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 def RunCompilerTests(build_info): | 272 def RunCompilerTests(build_info): |
| 269 test_flags = [] | 273 test_flags = [] |
| 270 if build_info.shard_index: | 274 if build_info.shard_index: |
| 271 test_flags = ['--shards=%s' % build_info.total_shards, | 275 test_flags = ['--shards=%s' % build_info.total_shards, |
| 272 '--shard=%s' % build_info.shard_index] | 276 '--shard=%s' % build_info.shard_index] |
| 273 | 277 |
| 274 if build_info.checked: test_flags += ['--checked'] | 278 if build_info.checked: test_flags += ['--checked'] |
| 275 | 279 |
| 276 if build_info.host_checked: test_flags += ['--host-checked'] | 280 if build_info.host_checked: test_flags += ['--host-checked'] |
| 277 | 281 |
| 282 if build_info.minify: test_flags += ['--minify'] |
| 283 |
| 278 TestCompiler(build_info.runtime, build_info.mode, build_info.system, | 284 TestCompiler(build_info.runtime, build_info.mode, build_info.system, |
| 279 list(test_flags), build_info.is_buildbot, build_info.test_set) | 285 list(test_flags), build_info.is_buildbot, build_info.test_set) |
| 280 | 286 |
| 281 # See comment in GetHasHardCodedCheckedMode, this is a hack. | 287 # See comment in GetHasHardCodedCheckedMode, this is a hack. |
| 282 if (GetHasHardCodedCheckedMode(build_info)): | 288 if (GetHasHardCodedCheckedMode(build_info)): |
| 283 TestCompiler(build_info.runtime, build_info.mode, build_info.system, | 289 TestCompiler(build_info.runtime, build_info.mode, build_info.system, |
| 284 test_flags + ['--checked'], build_info.is_buildbot, | 290 test_flags + ['--checked'], build_info.is_buildbot, |
| 285 build_info.test_set) | 291 build_info.test_set) |
| 286 | 292 |
| 287 if build_info.runtime != 'd8': | 293 if build_info.runtime != 'd8': |
| 288 CleanUpTemporaryFiles(build_info.system, build_info.runtime) | 294 CleanUpTemporaryFiles(build_info.system, build_info.runtime) |
| 289 | 295 |
| 290 | 296 |
| 291 if __name__ == '__main__': | 297 if __name__ == '__main__': |
| 292 bot.RunBot(GetBuildInfo, RunCompilerTests) | 298 bot.RunBot(GetBuildInfo, RunCompilerTests) |
| OLD | NEW |