| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 extras_flags = flags | 250 extras_flags = flags |
| 251 if (system == 'linux' | 251 if (system == 'linux' |
| 252 and runtime == 'd8' | 252 and runtime == 'd8' |
| 253 and not '--host-checked' in extras_flags): | 253 and not '--host-checked' in extras_flags): |
| 254 # Run the extra tests in checked mode, but only on linux/d8. | 254 # Run the extra tests in checked mode, but only on linux/d8. |
| 255 # Other systems have less resources and tend to time out. | 255 # Other systems have less resources and tend to time out. |
| 256 extras_flags = extras_flags + ['--host-checked'] | 256 extras_flags = extras_flags + ['--host-checked'] |
| 257 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extras, | 257 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extras, |
| 258 extras_flags, arch) | 258 extras_flags, arch) |
| 259 | 259 |
| 260 | |
| 261 def _DeleteTempWebdriverProfiles(directory): | |
| 262 """Find all the firefox profiles in a particular directory and delete them.""" | |
| 263 for f in os.listdir(directory): | |
| 264 item = os.path.join(directory, f) | |
| 265 if os.path.isdir(item) and (f.startswith('tmp') or f.startswith('opera')): | |
| 266 subprocess.Popen('rm -rf %s' % item, shell=True) | |
| 267 | |
| 268 | |
| 269 def CleanUpTemporaryFiles(system, browser): | |
| 270 """For some browser (selenium) tests, the browser creates a temporary profile | |
| 271 on each browser session start. On Windows, generally these files are | |
| 272 automatically deleted when all python processes complete. However, since our | |
| 273 buildbot slave script also runs on python, we never get the opportunity to | |
| 274 clear out the temp files, so we do so explicitly here. Our batch browser | |
| 275 testing will make this problem occur much less frequently, but will still | |
| 276 happen eventually unless we do this. | |
| 277 | |
| 278 This problem also occurs with batch tests in Firefox. For some reason selenium | |
| 279 automatically deletes the temporary profiles for Firefox for one browser, | |
| 280 but not multiple ones when we have many open batch tasks running. This | |
| 281 behavior has not been reproduced outside of the buildbots. | |
| 282 | |
| 283 Args: | |
| 284 - system: either 'linux', 'mac', 'windows' | |
| 285 - browser: one of the browsers, see GetBuildInfo | |
| 286 """ | |
| 287 if system == 'windows': | |
| 288 temp_dir = 'C:\\Users\\chrome-bot\\AppData\\Local\\Temp' | |
| 289 for name in os.listdir(temp_dir): | |
| 290 fullname = os.path.join(temp_dir, name) | |
| 291 if os.path.isdir(fullname): | |
| 292 shutil.rmtree(fullname, ignore_errors=True) | |
| 293 elif browser == 'ff' or 'opera': | |
| 294 # Note: the buildbots run as root, so we can do this without requiring a | |
| 295 # password. The command won't actually work on regular machines without | |
| 296 # root permissions. | |
| 297 _DeleteTempWebdriverProfiles('/tmp') | |
| 298 _DeleteTempWebdriverProfiles('/var/tmp') | |
| 299 | |
| 300 | |
| 301 def GetHasHardCodedCheckedMode(build_info): | 260 def GetHasHardCodedCheckedMode(build_info): |
| 302 # TODO(ricow): We currently run checked mode tests on chrome on linux and | 261 # TODO(ricow): We currently run checked mode tests on chrome on linux and |
| 303 # on the slow (all) IE windows bots. This is a hack and we should use the | 262 # on the slow (all) IE windows bots. This is a hack and we should use the |
| 304 # normal sharding and checked splitting functionality when we get more | 263 # normal sharding and checked splitting functionality when we get more |
| 305 # vms for testing this. | 264 # vms for testing this. |
| 306 if (build_info.system == 'linux' and build_info.runtime == 'drt'): | 265 if (build_info.system == 'linux' and build_info.runtime == 'drt'): |
| 307 return True | 266 return True |
| 308 if build_info.runtime.startswith('ie') and build_info.test_set == 'all': | 267 if build_info.runtime.startswith('ie') and build_info.test_set == 'all': |
| 309 return True | 268 return True |
| 310 return False | 269 return False |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 list(test_flags), build_info.is_buildbot, build_info.test_set, | 316 list(test_flags), build_info.is_buildbot, build_info.test_set, |
| 358 build_info.arch, compiler=build_info.compiler) | 317 build_info.arch, compiler=build_info.compiler) |
| 359 | 318 |
| 360 # See comment in GetHasHardCodedCheckedMode, this is a hack. | 319 # See comment in GetHasHardCodedCheckedMode, this is a hack. |
| 361 if (GetHasHardCodedCheckedMode(build_info)): | 320 if (GetHasHardCodedCheckedMode(build_info)): |
| 362 TestCompiler(build_info.runtime, build_info.mode, build_info.system, | 321 TestCompiler(build_info.runtime, build_info.mode, build_info.system, |
| 363 test_flags + ['--checked'], build_info.is_buildbot, | 322 test_flags + ['--checked'], build_info.is_buildbot, |
| 364 build_info.test_set, build_info.arch, | 323 build_info.test_set, build_info.arch, |
| 365 compiler=build_info.compiler) | 324 compiler=build_info.compiler) |
| 366 | 325 |
| 367 if build_info.runtime != 'd8': | |
| 368 CleanUpTemporaryFiles(build_info.system, build_info.runtime) | |
| 369 | |
| 370 | 326 |
| 371 def BuildCompiler(build_info): | 327 def BuildCompiler(build_info): |
| 372 """ | 328 """ |
| 373 Builds the SDK. | 329 Builds the SDK. |
| 374 | 330 |
| 375 - build_info: the buildInfo object, containing information about what sort of | 331 - build_info: the buildInfo object, containing information about what sort of |
| 376 build and test to be run. | 332 build and test to be run. |
| 377 """ | 333 """ |
| 378 with bot.BuildStep('Build SDK and d8'): | 334 with bot.BuildStep('Build SDK and d8'): |
| 379 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, | 335 args = [sys.executable, './tools/build.py', '--mode=' + build_info.mode, |
| 380 '--arch=' + build_info.arch, 'dart2js_bot'] | 336 '--arch=' + build_info.arch, 'dart2js_bot'] |
| 381 print 'Build SDK and d8: %s' % (' '.join(args)) | 337 print 'Build SDK and d8: %s' % (' '.join(args)) |
| 382 bot.RunProcess(args) | 338 bot.RunProcess(args) |
| 383 | 339 |
| 384 | 340 |
| 385 if __name__ == '__main__': | 341 if __name__ == '__main__': |
| 386 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) | 342 bot.RunBot(GetBuildInfo, RunCompilerTests, build_step=BuildCompiler) |
| OLD | NEW |