OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Runs all the buildbot steps for ChromeDriver except for update/compile.""" | 6 """Runs all the buildbot steps for ChromeDriver except for update/compile.""" |
7 | 7 |
8 import bisect | 8 import bisect |
9 import csv | 9 import csv |
10 import datetime | 10 import datetime |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 util.MarkBuildStepStart('updating LATEST_RELEASE to %s' % version) | 370 util.MarkBuildStepStart('updating LATEST_RELEASE to %s' % version) |
371 | 371 |
372 temp_latest_release_fname = tempfile.mkstemp()[1] | 372 temp_latest_release_fname = tempfile.mkstemp()[1] |
373 with open(temp_latest_release_fname, 'w') as f: | 373 with open(temp_latest_release_fname, 'w') as f: |
374 f.write(version) | 374 f.write(version) |
375 if slave_utils.GSUtilCopy(temp_latest_release_fname, latest_release_url, | 375 if slave_utils.GSUtilCopy(temp_latest_release_fname, latest_release_url, |
376 mimetype='text/plain'): | 376 mimetype='text/plain'): |
377 util.MarkBuildStepError() | 377 util.MarkBuildStepError() |
378 | 378 |
379 | 379 |
380 def _CleanTmpDir(): | |
381 tmp_dir = tempfile.gettempdir() | |
382 print 'cleaning temp directory:', tmp_dir | |
383 for file_name in os.listdir(tmp_dir): | |
384 file_path = os.path.join(tmp_dir, file_name) | |
385 if file_name.startswith('chromedriver_'): | |
386 if os.path.isdir(file_path): | |
387 print 'deleting sub-directory', file_path | |
388 shutil.rmtree(file_path, True) | |
389 else: | |
390 print 'deleting file', file_path | |
391 os.remove(file_path) | |
392 | |
393 | |
394 def _WaitForLatestSnapshot(commit_position): | 380 def _WaitForLatestSnapshot(commit_position): |
395 util.MarkBuildStepStart('wait_for_snapshot') | 381 util.MarkBuildStepStart('wait_for_snapshot') |
396 for attempt in range(0, 200): | 382 for attempt in range(0, 200): |
397 snapshot_position = archive.GetLatestSnapshotPosition() | 383 snapshot_position = archive.GetLatestSnapshotPosition() |
398 if commit_position is not None and snapshot_position is not None: | 384 if commit_position is not None and snapshot_position is not None: |
399 if int(snapshot_position) >= int(commit_position): | 385 if int(snapshot_position) >= int(commit_position): |
400 break | 386 break |
401 util.PrintAndFlush('Waiting for snapshot >= %s, found %s' % | 387 util.PrintAndFlush('Waiting for snapshot >= %s, found %s' % |
402 (commit_position, snapshot_position)) | 388 (commit_position, snapshot_position)) |
403 time.sleep(60) | 389 time.sleep(60) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 help='Update the test results log (only applicable to Android)') | 434 help='Update the test results log (only applicable to Android)') |
449 options, _ = parser.parse_args() | 435 options, _ = parser.parse_args() |
450 | 436 |
451 bitness = '32' | 437 bitness = '32' |
452 if util.Is64Bit(): | 438 if util.Is64Bit(): |
453 bitness = '64' | 439 bitness = '64' |
454 platform = '%s%s' % (util.GetPlatformName(), bitness) | 440 platform = '%s%s' % (util.GetPlatformName(), bitness) |
455 if options.android_packages: | 441 if options.android_packages: |
456 platform = 'android' | 442 platform = 'android' |
457 | 443 |
458 _CleanTmpDir() | |
459 | |
460 # Make sure any subprocesses (i.e. chromedriver) create temp files under | |
461 # $TMPDIR/chromedriver_*, so that they can be cleaned up by _CleanTempDir(). | |
462 if util.IsWindows(): | |
463 os.environ['TMP'] = os.environ['TEMP'] = util.MakeTempDir() | |
464 else: | |
465 os.environ['TMPDIR'] = util.MakeTempDir() | |
466 | |
467 if not options.revision: | 444 if not options.revision: |
468 commit_position = None | 445 commit_position = None |
469 else: | 446 else: |
470 commit_position = archive.GetCommitPositionFromGitHash(options.revision) | 447 commit_position = archive.GetCommitPositionFromGitHash(options.revision) |
471 | 448 |
472 if platform == 'android': | 449 if platform == 'android': |
473 if not options.revision and options.update_log: | 450 if not options.revision and options.update_log: |
474 parser.error('Must supply a --revision with --update-log') | 451 parser.error('Must supply a --revision with --update-log') |
475 _DownloadPrebuilts() | 452 _DownloadPrebuilts() |
476 else: | 453 else: |
(...skipping 30 matching lines...) Expand all Loading... |
507 util.MarkBuildStepStart('run_all_tests.py') | 484 util.MarkBuildStepStart('run_all_tests.py') |
508 util.MarkBuildStepError() | 485 util.MarkBuildStepError() |
509 | 486 |
510 # Add a "cleanup" step so that errors from runtest.py or bb_device_steps.py | 487 # Add a "cleanup" step so that errors from runtest.py or bb_device_steps.py |
511 # (which invoke this script) are kept in their own build step. | 488 # (which invoke this script) are kept in their own build step. |
512 util.MarkBuildStepStart('cleanup') | 489 util.MarkBuildStepStart('cleanup') |
513 | 490 |
514 | 491 |
515 if __name__ == '__main__': | 492 if __name__ == '__main__': |
516 main() | 493 main() |
OLD | NEW |