| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 if slave_utils.GSUtilCopy(temp_latest_release_fname, latest_release_url, | 378 if slave_utils.GSUtilCopy(temp_latest_release_fname, latest_release_url, |
| 379 mimetype='text/plain'): | 379 mimetype='text/plain'): |
| 380 util.MarkBuildStepError() | 380 util.MarkBuildStepError() |
| 381 | 381 |
| 382 | 382 |
| 383 def _CleanTmpDir(): | 383 def _CleanTmpDir(): |
| 384 tmp_dir = tempfile.gettempdir() | 384 tmp_dir = tempfile.gettempdir() |
| 385 print 'cleaning temp directory:', tmp_dir | 385 print 'cleaning temp directory:', tmp_dir |
| 386 for file_name in os.listdir(tmp_dir): | 386 for file_name in os.listdir(tmp_dir): |
| 387 file_path = os.path.join(tmp_dir, file_name) | 387 file_path = os.path.join(tmp_dir, file_name) |
| 388 if os.path.isdir(file_path): | |
| 389 print 'deleting sub-directory', file_path | |
| 390 shutil.rmtree(file_path, True) | |
| 391 if file_name.startswith('chromedriver_'): | 388 if file_name.startswith('chromedriver_'): |
| 392 print 'deleting file', file_path | 389 if os.path.isdir(file_path): |
| 393 os.remove(file_path) | 390 print 'deleting sub-directory', file_path |
| 391 shutil.rmtree(file_path, True) |
| 392 else: |
| 393 print 'deleting file', file_path |
| 394 os.remove(file_path) |
| 394 | 395 |
| 395 | 396 |
| 396 def _GetCommitPositionFromGitHash(snapshot_hashcode): | 397 def _GetCommitPositionFromGitHash(snapshot_hashcode): |
| 397 json_url = GS_GIT_LOG_URL % snapshot_hashcode | 398 json_url = GS_GIT_LOG_URL % snapshot_hashcode |
| 398 try: | 399 try: |
| 399 response = urllib2.urlopen(json_url) | 400 response = urllib2.urlopen(json_url) |
| 400 except urllib2.HTTPError as error: | 401 except urllib2.HTTPError as error: |
| 401 util.PrintAndFlush('HTTP Error %d' % error.getcode()) | 402 util.PrintAndFlush('HTTP Error %d' % error.getcode()) |
| 402 return None | 403 return None |
| 403 except urllib2.URLError as error: | 404 except urllib2.URLError as error: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 491 |
| 491 bitness = '32' | 492 bitness = '32' |
| 492 if util.IsLinux() and platform_module.architecture()[0] == '64bit': | 493 if util.IsLinux() and platform_module.architecture()[0] == '64bit': |
| 493 bitness = '64' | 494 bitness = '64' |
| 494 platform = '%s%s' % (util.GetPlatformName(), bitness) | 495 platform = '%s%s' % (util.GetPlatformName(), bitness) |
| 495 if options.android_packages: | 496 if options.android_packages: |
| 496 platform = 'android' | 497 platform = 'android' |
| 497 | 498 |
| 498 _CleanTmpDir() | 499 _CleanTmpDir() |
| 499 | 500 |
| 501 # Make sure any subprocesses (i.e. chromedriver) create temp files under |
| 502 # $TMPDIR/chromedriver_*, so that they can be cleaned up by _CleanTempDir(). |
| 503 if util.IsWindows(): |
| 504 os.environ['TMP'] = os.environ['TEMP'] = util.MakeTempDir() |
| 505 else: |
| 506 os.environ['TMPDIR'] = util.MakeTempDir() |
| 507 |
| 500 if not options.revision: | 508 if not options.revision: |
| 501 commit_position = None | 509 commit_position = None |
| 502 else: | 510 else: |
| 503 commit_position = _GetCommitPositionFromGitHash(options.revision) | 511 commit_position = _GetCommitPositionFromGitHash(options.revision) |
| 504 | 512 |
| 505 if platform == 'android': | 513 if platform == 'android': |
| 506 if not options.revision and options.update_log: | 514 if not options.revision and options.update_log: |
| 507 parser.error('Must supply a --revision with --update-log') | 515 parser.error('Must supply a --revision with --update-log') |
| 508 _DownloadPrebuilts() | 516 _DownloadPrebuilts() |
| 509 else: | 517 else: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 540 util.MarkBuildStepStart('run_all_tests.py') | 548 util.MarkBuildStepStart('run_all_tests.py') |
| 541 util.MarkBuildStepError() | 549 util.MarkBuildStepError() |
| 542 | 550 |
| 543 # Add a "cleanup" step so that errors from runtest.py or bb_device_steps.py | 551 # Add a "cleanup" step so that errors from runtest.py or bb_device_steps.py |
| 544 # (which invoke this script) are kept in their own build step. | 552 # (which invoke this script) are kept in their own build step. |
| 545 util.MarkBuildStepStart('cleanup') | 553 util.MarkBuildStepStart('cleanup') |
| 546 | 554 |
| 547 | 555 |
| 548 if __name__ == '__main__': | 556 if __name__ == '__main__': |
| 549 main() | 557 main() |
| OLD | NEW |