| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be 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 os |
| 13 import platform | 14 import platform |
| 14 import os | |
| 15 import re | 15 import re |
| 16 import shutil | 16 import shutil |
| 17 import socket |
| 17 import subprocess | 18 import subprocess |
| 18 import sys | 19 import sys |
| 19 | 20 |
| 20 import bot | 21 import bot |
| 21 | 22 |
| 22 DART2JS_BUILDER = ( | 23 DART2JS_BUILDER = ( |
| 23 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch
ecked))?(-(host-checked))?(-(minified))?-?(\d*)-?(\d*)') | 24 r'dart2js-(linux|mac|windows)(-(jsshell))?-(debug|release)(-(checked|host-ch
ecked))?(-(host-checked))?(-(minified))?-?(\d*)-?(\d*)') |
| 24 WEB_BUILDER = ( | 25 WEB_BUILDER = ( |
| 25 r'dart2js-(ie9|ie10|ff|safari|chrome|opera)-(win7|win8|mac10\.8|mac10\.7|lin
ux)(-(all|html))?(-(csp))?(-(\d+)-(\d+))?') | 26 r'dart2js-(ie9|ie10|ff|safari|chrome|chromeOnAndroid|opera)-(win7|win8|mac10
\.8|mac10\.7|linux)(-(all|html))?(-(csp))?(-(\d+)-(\d+))?') |
| 26 | 27 |
| 27 | 28 |
| 28 def GetBuildInfo(builder_name, is_buildbot): | 29 def GetBuildInfo(builder_name, is_buildbot): |
| 29 """Returns a BuildInfo object for the current buildbot based on the | 30 """Returns a BuildInfo object for the current buildbot based on the |
| 30 name of the builder. | 31 name of the builder. |
| 31 """ | 32 """ |
| 32 compiler = None | 33 compiler = None |
| 33 runtime = None | 34 runtime = None |
| 34 mode = None | 35 mode = None |
| 35 system = None | 36 system = None |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if runtime == "safari": | 139 if runtime == "safari": |
| 139 cmd.append('--nobatch') | 140 cmd.append('--nobatch') |
| 140 | 141 |
| 141 if user_test == 'yes': | 142 if user_test == 'yes': |
| 142 cmd.append('--progress=color') | 143 cmd.append('--progress=color') |
| 143 else: | 144 else: |
| 144 cmd.extend(['--progress=buildbot', '-v']) | 145 cmd.extend(['--progress=buildbot', '-v']) |
| 145 | 146 |
| 146 # TODO(ricow): temporary hack to run on fyi with --use_browser_controller | 147 # TODO(ricow): temporary hack to run on fyi with --use_browser_controller |
| 147 if (os.environ.get('BUILDBOT_SCHEDULER') == "fyi-main" and | 148 if (os.environ.get('BUILDBOT_SCHEDULER') == "fyi-main" and |
| 148 (runtime == 'chrome' or runtime == 'ff')): | 149 runtime in ['chrome', 'ff', 'chromeOnAndroid']): |
| 149 cmd.append('--use_browser_controller') | 150 cmd.append('--use_browser_controller') |
| 150 | 151 |
| 151 global IsFirstTestStepCall | 152 global IsFirstTestStepCall |
| 152 if IsFirstTestStepCall: | 153 if IsFirstTestStepCall: |
| 153 IsFirstTestStepCall = False | 154 IsFirstTestStepCall = False |
| 154 else: | 155 else: |
| 155 cmd.append('--append_logs') | 156 cmd.append('--append_logs') |
| 156 | 157 |
| 157 if flags: | 158 if flags: |
| 158 cmd.extend(flags) | 159 cmd.extend(flags) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 # on the slow (all) IE windows bots. This is a hack and we should use the | 290 # on the slow (all) IE windows bots. This is a hack and we should use the |
| 290 # normal sharding and checked splitting functionality when we get more | 291 # normal sharding and checked splitting functionality when we get more |
| 291 # vms for testing this. | 292 # vms for testing this. |
| 292 if (build_info.system == 'linux' and build_info.runtime == 'chrome'): | 293 if (build_info.system == 'linux' and build_info.runtime == 'chrome'): |
| 293 return True | 294 return True |
| 294 if build_info.runtime.startswith('ie') and build_info.test_set == 'all': | 295 if build_info.runtime.startswith('ie') and build_info.test_set == 'all': |
| 295 return True | 296 return True |
| 296 return False | 297 return False |
| 297 | 298 |
| 298 | 299 |
| 300 def GetLocalIPAddress(): |
| 301 hostname = socket.gethostname() |
| 302 # '$ host chromeperf02' results for example in |
| 303 # 'chromeperf02.perf.chromium.org has address 172.22.28.55' |
| 304 output = subprocess.check_output(["host", hostname]) |
| 305 match = re.match(r'.*\s+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s+.*', output) |
| 306 if not match: |
| 307 raise Exception("Could not determine local ip address " |
| 308 "(hostname: '%s', host command output: '%s')." |
| 309 % (hostname, output)) |
| 310 return match.group(1) |
| 311 |
| 312 def AddAndroidToolsToPath(): |
| 313 par_dir = os.path.pardir |
| 314 join = os.path.join |
| 315 |
| 316 dart_dir = join(os.path.dirname(__file__), par_dir, par_dir) |
| 317 android_sdk = join(dart_dir, 'third_party', 'android_tools', 'sdk') |
| 318 tools_dir = os.path.abspath(join(android_sdk, 'tools')) |
| 319 platform_tools_dir = os.path.abspath(join(android_sdk, 'platform-tools')) |
| 320 os.environ['PATH'] = os.pathsep.join( |
| 321 [os.environ['PATH'], tools_dir, platform_tools_dir]) |
| 322 |
| 299 def RunCompilerTests(build_info): | 323 def RunCompilerTests(build_info): |
| 300 test_flags = [] | 324 test_flags = [] |
| 301 if build_info.shard_index: | 325 if build_info.shard_index: |
| 302 test_flags = ['--shards=%s' % build_info.total_shards, | 326 test_flags = ['--shards=%s' % build_info.total_shards, |
| 303 '--shard=%s' % build_info.shard_index] | 327 '--shard=%s' % build_info.shard_index] |
| 304 | 328 |
| 305 if build_info.checked: test_flags += ['--checked'] | 329 if build_info.checked: test_flags += ['--checked'] |
| 306 | 330 |
| 307 if build_info.host_checked: test_flags += ['--host-checked'] | 331 if build_info.host_checked: test_flags += ['--host-checked'] |
| 308 | 332 |
| 309 if build_info.minified: test_flags += ['--minified'] | 333 if build_info.minified: test_flags += ['--minified'] |
| 310 | 334 |
| 311 if build_info.csp: test_flags += ['--csp'] | 335 if build_info.csp: test_flags += ['--csp'] |
| 312 | 336 |
| 337 if build_info.runtime == 'chromeOnAndroid': |
| 338 test_flags.append('--local_ip=%s' % GetLocalIPAddress()) |
| 339 # test.py expects the android tools directories to be in PATH |
| 340 # (they contain for example 'adb') |
| 341 AddAndroidToolsToPath() |
| 342 |
| 313 TestCompiler(build_info.runtime, build_info.mode, build_info.system, | 343 TestCompiler(build_info.runtime, build_info.mode, build_info.system, |
| 314 list(test_flags), build_info.is_buildbot, build_info.test_set) | 344 list(test_flags), build_info.is_buildbot, build_info.test_set) |
| 315 | 345 |
| 316 # See comment in GetHasHardCodedCheckedMode, this is a hack. | 346 # See comment in GetHasHardCodedCheckedMode, this is a hack. |
| 317 if (GetHasHardCodedCheckedMode(build_info)): | 347 if (GetHasHardCodedCheckedMode(build_info)): |
| 318 TestCompiler(build_info.runtime, build_info.mode, build_info.system, | 348 TestCompiler(build_info.runtime, build_info.mode, build_info.system, |
| 319 test_flags + ['--checked'], build_info.is_buildbot, | 349 test_flags + ['--checked'], build_info.is_buildbot, |
| 320 build_info.test_set) | 350 build_info.test_set) |
| 321 | 351 |
| 322 if build_info.runtime != 'd8': | 352 if build_info.runtime != 'd8': |
| 323 CleanUpTemporaryFiles(build_info.system, build_info.runtime) | 353 CleanUpTemporaryFiles(build_info.system, build_info.runtime) |
| 324 | 354 |
| 325 | 355 |
| 326 def BuildCompiler(build_info): | 356 def BuildCompiler(build_info): |
| 327 """ | 357 """ |
| 328 Builds the SDK. | 358 Builds the SDK. |
| 329 | 359 |
| 330 - build_info: the buildInfo object, containing information about what sort of | 360 - build_info: the buildInfo object, containing information about what sort of |
| 331 build and test to be run. | 361 build and test to be run. |
| 332 """ | 362 """ |
| 333 with bot.BuildStep('Build SDK and d8'): | 363 with bot.BuildStep('Build SDK and d8'): |
| 334 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, | 364 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, |
| 335 'dart2js_bot'] | 365 'dart2js_bot'] |
| 336 print 'Build SDK and d8: %s' % (' '.join(args)) | 366 print 'Build SDK and d8: %s' % (' '.join(args)) |
| 337 bot.RunProcess(args) | 367 bot.RunProcess(args) |
| 338 | 368 |
| 339 | 369 |
| 340 if __name__ == '__main__': | 370 if __name__ == '__main__': |
| 341 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) | 371 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) |
| OLD | NEW |