Chromium Code Reviews| 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 """Dart2js buildbot steps | 7 """Dart2js buildbot steps |
| 8 | 8 |
| 9 Runs tests for the 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 BUILDER_CLOBBER = 'BUILDBOT_CLOBBER' | 21 BUILDER_CLOBBER = 'BUILDBOT_CLOBBER' |
| 22 | 22 |
| 23 | 23 |
| 24 DART_PATH = os.path.dirname( | 24 DART_PATH = os.path.dirname( |
| 25 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 25 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 26 | 26 |
| 27 DART2JS_BUILDER = ( | 27 DART2JS_BUILDER = ( |
| 28 r'dart2js-(linux|mac|windows)-(debug|release)(-(checked|host-checked))?(-(ho st-checked))?-?(\d*)-?(\d*)') | 28 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch ecked))?(-(host-checked))?-?(\d*)-?(\d*)') |
| 29 WEB_BUILDER = ( | 29 WEB_BUILDER = ( |
| 30 r'dart2js-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)(-(all|html))?') | 30 r'dart2js-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)(-(all|html))?') |
| 31 | 31 |
| 32 NO_COLOR_ENV = dict(os.environ) | 32 NO_COLOR_ENV = dict(os.environ) |
| 33 NO_COLOR_ENV['TERM'] = 'nocolor' | 33 NO_COLOR_ENV['TERM'] = 'nocolor' |
| 34 | 34 |
| 35 class BuildInfo(object): | 35 class BuildInfo(object): |
| 36 """ Encapsulation of build information. | 36 """ Encapsulation of build information. |
| 37 - compiler: 'dart2js' or None when the builder has an incorrect name | 37 - compiler: 'dart2js' or None when the builder has an incorrect name |
| 38 - runtime: 'd8', 'ie', 'ff', 'safari', 'chrome', 'opera' | 38 - runtime: 'd8', 'ie', 'ff', 'safari', 'chrome', 'opera' |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 web_pattern = re.match(WEB_BUILDER, builder_name) | 106 web_pattern = re.match(WEB_BUILDER, builder_name) |
| 107 | 107 |
| 108 if web_pattern: | 108 if web_pattern: |
| 109 compiler = 'dart2js' | 109 compiler = 'dart2js' |
| 110 runtime = web_pattern.group(1) | 110 runtime = web_pattern.group(1) |
| 111 system = web_pattern.group(2) | 111 system = web_pattern.group(2) |
| 112 mode = 'release' | 112 mode = 'release' |
| 113 test_set = web_pattern.group(4) | 113 test_set = web_pattern.group(4) |
| 114 elif dart2js_pattern: | 114 elif dart2js_pattern: |
| 115 compiler = 'dart2js' | 115 compiler = 'dart2js' |
| 116 system = dart2js_pattern.group(1) | |
| 116 runtime = 'd8' | 117 runtime = 'd8' |
| 117 system = dart2js_pattern.group(1) | 118 if dart2js_pattern.group(3) == 'jsshell': |
|
ricow1
2012/10/05 12:29:36
I can change this, but that requires us to change
| |
| 118 mode = dart2js_pattern.group(2) | 119 runtime = 'jsshell' |
| 120 mode = dart2js_pattern.group(4) | |
| 119 # The valid naming parts for checked and host-checked are: | 121 # The valid naming parts for checked and host-checked are: |
| 120 # Empty: checked=False, host_checked=False | 122 # Empty: checked=False, host_checked=False |
| 121 # -checked: checked=True, host_checked=False | 123 # -checked: checked=True, host_checked=False |
| 122 # -host-checked: checked=False, host_checked=True | 124 # -host-checked: checked=False, host_checked=True |
| 123 # -checked-host-checked: checked=True, host_checked=True | 125 # -checked-host-checked: checked=True, host_checked=True |
| 124 if dart2js_pattern.group(4) == 'checked': | 126 if dart2js_pattern.group(6) == 'checked': |
| 125 checked = True | 127 checked = True |
| 126 if dart2js_pattern.group(4) == 'host-checked': | |
| 127 host_checked = True | |
| 128 if dart2js_pattern.group(6) == 'host-checked': | 128 if dart2js_pattern.group(6) == 'host-checked': |
| 129 host_checked = True | 129 host_checked = True |
| 130 shard_index = dart2js_pattern.group(7) | 130 if dart2js_pattern.group(8) == 'host-checked': |
| 131 total_shards = dart2js_pattern.group(8) | 131 host_checked = True |
| 132 shard_index = dart2js_pattern.group(9) | |
| 133 total_shards = dart2js_pattern.group(10) | |
| 132 | 134 |
| 133 if system == 'windows': | 135 if system == 'windows': |
| 134 system = 'win7' | 136 system = 'win7' |
| 135 | 137 |
| 136 if (system == 'win7' and platform.system() != 'Windows') or ( | 138 if (system == 'win7' and platform.system() != 'Windows') or ( |
| 137 system == 'mac' and platform.system() != 'Darwin') or ( | 139 system == 'mac' and platform.system() != 'Darwin') or ( |
| 138 system == 'linux' and platform.system() != 'Linux'): | 140 system == 'linux' and platform.system() != 'Linux'): |
| 139 print ('Error: You cannot emulate a buildbot with a platform different ' | 141 print ('Error: You cannot emulate a buildbot with a platform different ' |
| 140 'from your own.') | 142 'from your own.') |
| 141 sys.exit(1) | 143 sys.exit(1) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 os.chdir(DART_PATH) | 202 os.chdir(DART_PATH) |
| 201 | 203 |
| 202 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] | 204 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'create_sdk'] |
| 203 print 'running %s' % (' '.join(args)) | 205 print 'running %s' % (' '.join(args)) |
| 204 return subprocess.call(args, env=NO_COLOR_ENV) | 206 return subprocess.call(args, env=NO_COLOR_ENV) |
| 205 | 207 |
| 206 | 208 |
| 207 def TestCompiler(runtime, mode, system, flags, is_buildbot, test_set): | 209 def TestCompiler(runtime, mode, system, flags, is_buildbot, test_set): |
| 208 """ test the compiler. | 210 """ test the compiler. |
| 209 Args: | 211 Args: |
| 210 - runtime: either 'd8', or one of the browsers, see GetBuildInfo | 212 - runtime: either 'd8', 'jsshell', or one of the browsers, see GetBuildInfo |
| 211 - mode: either 'debug' or 'release' | 213 - mode: either 'debug' or 'release' |
| 212 - system: either 'linux', 'mac', or 'win7' | 214 - system: either 'linux', 'mac', or 'win7' |
| 213 - flags: extra flags to pass to test.dart | 215 - flags: extra flags to pass to test.dart |
| 214 - is_buildbot: true if we are running on a real buildbot instead of | 216 - is_buildbot: true if we are running on a real buildbot instead of |
| 215 emulating one. | 217 emulating one. |
| 216 - test_set: Specification of a non standard test set, default None | 218 - test_set: Specification of a non standard test set, default None |
| 217 """ | 219 """ |
| 218 | 220 |
| 219 # Make sure we are in the dart directory | 221 # Make sure we are in the dart directory |
| 220 os.chdir(DART_PATH) | 222 os.chdir(DART_PATH) |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 build_info.is_buildbot, | 404 build_info.is_buildbot, |
| 403 build_info.test_set) | 405 build_info.test_set) |
| 404 | 406 |
| 405 if build_info.runtime != 'd8': CleanUpTemporaryFiles(build_info.system, | 407 if build_info.runtime != 'd8': CleanUpTemporaryFiles(build_info.system, |
| 406 build_info.runtime) | 408 build_info.runtime) |
| 407 if status != 0: print '@@@STEP_FAILURE@@@' | 409 if status != 0: print '@@@STEP_FAILURE@@@' |
| 408 return status | 410 return status |
| 409 | 411 |
| 410 if __name__ == '__main__': | 412 if __name__ == '__main__': |
| 411 sys.exit(main()) | 413 sys.exit(main()) |
| OLD | NEW |