| 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. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if dart2js_pattern.group(8) == 'host-checked': | 74 if dart2js_pattern.group(8) == 'host-checked': |
| 75 host_checked = True | 75 host_checked = True |
| 76 if dart2js_pattern.group(10) == 'minified': | 76 if dart2js_pattern.group(10) == 'minified': |
| 77 minified = True | 77 minified = True |
| 78 shard_index = dart2js_pattern.group(11) | 78 shard_index = dart2js_pattern.group(11) |
| 79 total_shards = dart2js_pattern.group(12) | 79 total_shards = dart2js_pattern.group(12) |
| 80 else : | 80 else : |
| 81 return None | 81 return None |
| 82 | 82 |
| 83 # We have both win7 and win8 bots, functionality is the same. | 83 # We have both win7 and win8 bots, functionality is the same. |
| 84 if system.startsWith('win'): | 84 if system.startswith('win'): |
| 85 system = 'windows' | 85 system = 'windows' |
| 86 | 86 |
| 87 # We have both 10.8 and 10.7 bots, functionality is the same. | 87 # We have both 10.8 and 10.7 bots, functionality is the same. |
| 88 if system == 'mac10.8' or system == 'mac10.7': | 88 if system == 'mac10.8' or system == 'mac10.7': |
| 89 system = 'mac' | 89 system = 'mac' |
| 90 | 90 |
| 91 if (system == 'win7' and platform.system() != 'Windows') or ( | 91 if (system == 'windows' and platform.system() != 'Windows') or ( |
| 92 system == 'mac' and platform.system() != 'Darwin') or ( | 92 system == 'mac' and platform.system() != 'Darwin') or ( |
| 93 system == 'linux' and platform.system() != 'Linux'): | 93 system == 'linux' and platform.system() != 'Linux'): |
| 94 print ('Error: You cannot emulate a buildbot with a platform different ' | 94 print ('Error: You cannot emulate a buildbot with a platform different ' |
| 95 'from your own.') | 95 'from your own.') |
| 96 return None | 96 return None |
| 97 return bot.BuildInfo(compiler, runtime, mode, system, checked, host_checked, | 97 return bot.BuildInfo(compiler, runtime, mode, system, checked, host_checked, |
| 98 minified, shard_index, total_shards, is_buildbot, | 98 minified, shard_index, total_shards, is_buildbot, |
| 99 test_set, csp) | 99 test_set, csp) |
| 100 | 100 |
| 101 | 101 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 print 'Running: %s' % (' '.join(map(lambda arg: '"%s"' % arg, cmd))) | 182 print 'Running: %s' % (' '.join(map(lambda arg: '"%s"' % arg, cmd))) |
| 183 bot.RunProcess(cmd) | 183 bot.RunProcess(cmd) |
| 184 | 184 |
| 185 | 185 |
| 186 def TestCompiler(runtime, mode, system, flags, is_buildbot, test_set): | 186 def TestCompiler(runtime, mode, system, flags, is_buildbot, test_set): |
| 187 """ test the compiler. | 187 """ test the compiler. |
| 188 Args: | 188 Args: |
| 189 - runtime: either 'd8', 'jsshell', or one of the browsers, see GetBuildInfo | 189 - runtime: either 'd8', 'jsshell', or one of the browsers, see GetBuildInfo |
| 190 - mode: either 'debug' or 'release' | 190 - mode: either 'debug' or 'release' |
| 191 - system: either 'linux', 'mac', 'win7', or 'win8' | 191 - system: either 'linux', 'mac', 'windows' |
| 192 - flags: extra flags to pass to test.dart | 192 - flags: extra flags to pass to test.dart |
| 193 - is_buildbot: true if we are running on a real buildbot instead of | 193 - is_buildbot: true if we are running on a real buildbot instead of |
| 194 emulating one. | 194 emulating one. |
| 195 - test_set: Specification of a non standard test set, default None | 195 - test_set: Specification of a non standard test set, default None |
| 196 """ | 196 """ |
| 197 | 197 |
| 198 def GetPath(runtime): | 198 def GetPath(runtime): |
| 199 """ Helper to get the path to the Chrome or Firefox executable for a | 199 """ Helper to get the path to the Chrome or Firefox executable for a |
| 200 particular platform on the buildbot. Throws a KeyError if runtime is not | 200 particular platform on the buildbot. Throws a KeyError if runtime is not |
| 201 either 'chrome' or 'ff'.""" | 201 either 'chrome' or 'ff'.""" |
| 202 if system == 'mac': | 202 if system == 'mac': |
| 203 partDict = {'chrome': 'Google\\ Chrome', 'ff': 'Firefox'} | 203 partDict = {'chrome': 'Google\\ Chrome', 'ff': 'Firefox'} |
| 204 mac_path = '/Applications/%s.app/Contents/MacOS/%s' | 204 mac_path = '/Applications/%s.app/Contents/MacOS/%s' |
| 205 path_dict = {'chrome': mac_path % (partDict[runtime], partDict[runtime]), | 205 path_dict = {'chrome': mac_path % (partDict[runtime], partDict[runtime]), |
| 206 'ff': mac_path % (partDict[runtime], partDict[runtime].lower())} | 206 'ff': mac_path % (partDict[runtime], partDict[runtime].lower())} |
| 207 elif system == 'linux': | 207 elif system == 'linux': |
| 208 path_dict = {'ff': 'firefox', 'chrome': 'google-chrome'} | 208 path_dict = {'ff': 'firefox', 'chrome': 'google-chrome'} |
| 209 else: | 209 else: |
| 210 # Windows. | 210 # Windows. |
| 211 path_dict = {'ff': os.path.join('C:/', 'Program Files (x86)', | 211 path_dict = {'ff': os.path.join('C:/', 'Program Files (x86)', |
| 212 'Mozilla Firefox', 'firefox.exe'), | 212 'Mozilla Firefox', 'firefox.exe'), |
| 213 'chrome': os.path.join('C:/', 'Users', 'chrome-bot', 'AppData', | 213 'chrome': os.path.join('C:/', 'Users', 'chrome-bot', 'AppData', |
| 214 'Local', 'Google', 'Chrome', 'Application', 'chrome.exe')} | 214 'Local', 'Google', 'Chrome', 'Application', 'chrome.exe')} |
| 215 return path_dict[runtime] | 215 return path_dict[runtime] |
| 216 | 216 |
| 217 if (runtime == 'ff' or runtime == 'chrome') and is_buildbot: | 217 if (runtime == 'ff' or runtime == 'chrome') and is_buildbot: |
| 218 # Print out browser version numbers if we're running on the buildbot (where | 218 # Print out browser version numbers if we're running on the buildbot (where |
| 219 # we know the paths to these browser installations). | 219 # we know the paths to these browser installations). |
| 220 version_query_string = '"%s" --version' % GetPath(runtime) | 220 version_query_string = '"%s" --version' % GetPath(runtime) |
| 221 if runtime == 'ff' and system.startswith('win'): | 221 if runtime == 'ff' and system == 'windows': |
| 222 version_query_string += '| more' | 222 version_query_string += '| more' |
| 223 elif runtime == 'chrome' and system.startswith('win'): | 223 elif runtime == 'chrome' and system == 'windows': |
| 224 version_query_string = ('''reg query "HKCU\\Software\\Microsoft\\''' + | 224 version_query_string = ('''reg query "HKCU\\Software\\Microsoft\\''' + |
| 225 '''Windows\\CurrentVersion\\Uninstall\\Google Chrome" /v Version''') | 225 '''Windows\\CurrentVersion\\Uninstall\\Google Chrome" /v Version''') |
| 226 p = subprocess.Popen(version_query_string, | 226 p = subprocess.Popen(version_query_string, |
| 227 stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) | 227 stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
| 228 output, stderr = p.communicate() | 228 output, stderr = p.communicate() |
| 229 output = output.split() | 229 output = output.split() |
| 230 try: | 230 try: |
| 231 print 'Version of %s: %s' % (runtime, output[-1]) | 231 print 'Version of %s: %s' % (runtime, output[-1]) |
| 232 except IndexError: | 232 except IndexError: |
| 233 # Failed to obtain version information. Continue running tests. | 233 # Failed to obtain version information. Continue running tests. |
| 234 pass | 234 pass |
| 235 | 235 |
| 236 if runtime == 'd8': | 236 if runtime == 'd8': |
| 237 # The dart2js compiler isn't self-hosted (yet) so we run its | 237 # The dart2js compiler isn't self-hosted (yet) so we run its |
| 238 # unit tests on the VM. We avoid doing this on the builders | 238 # unit tests on the VM. We avoid doing this on the builders |
| 239 # that run the browser tests to cut down on the cycle time. | 239 # that run the browser tests to cut down on the cycle time. |
| 240 unit_test_flags = [flag for flag in flags if flag.startswith('--shard')] | 240 unit_test_flags = [flag for flag in flags if flag.startswith('--shard')] |
| 241 # Run the unit tests in checked mode (the VM's checked mode). | 241 # Run the unit tests in checked mode (the VM's checked mode). |
| 242 unit_test_flags.append('--checked') | 242 unit_test_flags.append('--checked') |
| 243 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['dart2js'], | 243 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['dart2js'], |
| 244 unit_test_flags) | 244 unit_test_flags) |
| 245 | 245 |
| 246 if system.startswith('win') and runtime.startswith('ie10'): | 246 if system == 'windows' and runtime == 'ie10': |
| 247 TestStep("dart2js", mode, system, 'dart2js', runtime, ['html'], flags) | 247 TestStep("dart2js", mode, system, 'dart2js', runtime, ['html'], flags) |
| 248 else: | 248 else: |
| 249 # Run the default set of test suites. | 249 # Run the default set of test suites. |
| 250 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) | 250 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) |
| 251 | 251 |
| 252 # TODO(kasperl): Consider running peg and css tests too. | 252 # TODO(kasperl): Consider running peg and css tests too. |
| 253 extras = ['dart2js_extra', 'dart2js_native', 'dart2js_foreign'] | 253 extras = ['dart2js_extra', 'dart2js_native', 'dart2js_foreign'] |
| 254 extras_flags = flags | 254 extras_flags = flags |
| 255 if (system == 'linux' | 255 if (system == 'linux' |
| 256 and runtime == 'd8' | 256 and runtime == 'd8' |
| (...skipping 21 matching lines...) Expand all Loading... |
| 278 clear out the temp files, so we do so explicitly here. Our batch browser | 278 clear out the temp files, so we do so explicitly here. Our batch browser |
| 279 testing will make this problem occur much less frequently, but will still | 279 testing will make this problem occur much less frequently, but will still |
| 280 happen eventually unless we do this. | 280 happen eventually unless we do this. |
| 281 | 281 |
| 282 This problem also occurs with batch tests in Firefox. For some reason selenium | 282 This problem also occurs with batch tests in Firefox. For some reason selenium |
| 283 automatically deletes the temporary profiles for Firefox for one browser, | 283 automatically deletes the temporary profiles for Firefox for one browser, |
| 284 but not multiple ones when we have many open batch tasks running. This | 284 but not multiple ones when we have many open batch tasks running. This |
| 285 behavior has not been reproduced outside of the buildbots. | 285 behavior has not been reproduced outside of the buildbots. |
| 286 | 286 |
| 287 Args: | 287 Args: |
| 288 - system: either 'linux', 'mac', 'win7', or 'win8' | 288 - system: either 'linux', 'mac', 'windows' |
| 289 - browser: one of the browsers, see GetBuildInfo | 289 - browser: one of the browsers, see GetBuildInfo |
| 290 """ | 290 """ |
| 291 if system.startswith('win'): | 291 if system == 'windows': |
| 292 temp_dir = 'C:\\Users\\chrome-bot\\AppData\\Local\\Temp' | 292 temp_dir = 'C:\\Users\\chrome-bot\\AppData\\Local\\Temp' |
| 293 for name in os.listdir(temp_dir): | 293 for name in os.listdir(temp_dir): |
| 294 fullname = os.path.join(temp_dir, name) | 294 fullname = os.path.join(temp_dir, name) |
| 295 if os.path.isdir(fullname): | 295 if os.path.isdir(fullname): |
| 296 shutil.rmtree(fullname, ignore_errors=True) | 296 shutil.rmtree(fullname, ignore_errors=True) |
| 297 elif browser == 'ff' or 'opera': | 297 elif browser == 'ff' or 'opera': |
| 298 # Note: the buildbots run as root, so we can do this without requiring a | 298 # Note: the buildbots run as root, so we can do this without requiring a |
| 299 # password. The command won't actually work on regular machines without | 299 # password. The command won't actually work on regular machines without |
| 300 # root permissions. | 300 # root permissions. |
| 301 _DeleteTempWebdriverProfiles('/tmp') | 301 _DeleteTempWebdriverProfiles('/tmp') |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 """ | 379 """ |
| 380 with bot.BuildStep('Build SDK and d8'): | 380 with bot.BuildStep('Build SDK and d8'): |
| 381 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, | 381 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, |
| 382 'dart2js_bot'] | 382 'dart2js_bot'] |
| 383 print 'Build SDK and d8: %s' % (' '.join(args)) | 383 print 'Build SDK and d8: %s' % (' '.join(args)) |
| 384 bot.RunProcess(args) | 384 bot.RunProcess(args) |
| 385 | 385 |
| 386 | 386 |
| 387 if __name__ == '__main__': | 387 if __name__ == '__main__': |
| 388 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) | 388 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) |
| OLD | NEW |