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 13 matching lines...) Expand all Loading... |
24 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 24 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
25 GS_CHROMEDRIVER_BUCKET = 'gs://chromedriver' | 25 GS_CHROMEDRIVER_BUCKET = 'gs://chromedriver' |
26 GS_CHROMEDRIVER_DATA_BUCKET = 'gs://chromedriver-data' | 26 GS_CHROMEDRIVER_DATA_BUCKET = 'gs://chromedriver-data' |
27 GS_CHROMEDRIVER_RELEASE_URL = 'http://chromedriver.storage.googleapis.com' | 27 GS_CHROMEDRIVER_RELEASE_URL = 'http://chromedriver.storage.googleapis.com' |
28 GS_CONTINUOUS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/continuous' | 28 GS_CONTINUOUS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/continuous' |
29 GS_PREBUILTS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/prebuilts' | 29 GS_PREBUILTS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/prebuilts' |
30 GS_SERVER_LOGS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/server_logs' | 30 GS_SERVER_LOGS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/server_logs' |
31 SERVER_LOGS_LINK = ( | 31 SERVER_LOGS_LINK = ( |
32 'http://chromedriver-data.storage.googleapis.com/server_logs') | 32 'http://chromedriver-data.storage.googleapis.com/server_logs') |
33 TEST_LOG_FORMAT = '%s_log.json' | 33 TEST_LOG_FORMAT = '%s_log.json' |
| 34 GS_GITHASH_TO_SVN_URL =\ |
| 35 'https://chromium.googlesource.com/chromium/src/+/%s?format=json' |
| 36 GS_SEARCH_PATTERN =\ |
| 37 r'.*git-svn-id: svn://svn.chromium.org/chrome/trunk/src@(\d+) ' |
34 | 38 |
35 SCRIPT_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, os.pardir, | 39 SCRIPT_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, os.pardir, |
36 os.pardir, os.pardir, os.pardir, 'scripts') | 40 os.pardir, os.pardir, os.pardir, 'scripts') |
37 SITE_CONFIG_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, | 41 SITE_CONFIG_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, |
38 os.pardir, os.pardir, os.pardir, os.pardir, | 42 os.pardir, os.pardir, os.pardir, os.pardir, |
39 'site_config') | 43 'site_config') |
40 sys.path.append(SCRIPT_DIR) | 44 sys.path.append(SCRIPT_DIR) |
41 sys.path.append(SITE_CONFIG_DIR) | 45 sys.path.append(SITE_CONFIG_DIR) |
42 | 46 |
43 import archive | 47 import archive |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 print 'cleaning temp directory:', tmp_dir | 376 print 'cleaning temp directory:', tmp_dir |
373 for file_name in os.listdir(tmp_dir): | 377 for file_name in os.listdir(tmp_dir): |
374 file_path = os.path.join(tmp_dir, file_name) | 378 file_path = os.path.join(tmp_dir, file_name) |
375 if os.path.isdir(file_path): | 379 if os.path.isdir(file_path): |
376 print 'deleting sub-directory', file_path | 380 print 'deleting sub-directory', file_path |
377 shutil.rmtree(file_path, True) | 381 shutil.rmtree(file_path, True) |
378 if file_name.startswith('chromedriver_'): | 382 if file_name.startswith('chromedriver_'): |
379 print 'deleting file', file_path | 383 print 'deleting file', file_path |
380 os.remove(file_path) | 384 os.remove(file_path) |
381 | 385 |
| 386 def _GetSVNRevisionFromGitHash(snapshot_revision): |
| 387 json_url = GS_GITHASH_TO_SVN_URL % snapshot_revision |
| 388 try: |
| 389 response = urllib2.urlopen(json_url) |
| 390 except urllib2.HTTPError, error: |
| 391 util.PrintAndFlush('HTTP Error %d' % error.getcode()) |
| 392 return None |
| 393 data = json.loads(response.read()[4:]) |
| 394 if 'message' in data: |
| 395 message = data['message'].split('\n') |
| 396 message = [line for line in message if line.strip()] |
| 397 search_pattern = re.compile(GS_SEARCH_PATTERN) |
| 398 result = search_pattern.search(message[len(message)-1]) |
| 399 if result: |
| 400 return result.group(1) |
| 401 return None |
382 | 402 |
383 def _WaitForLatestSnapshot(revision): | 403 def _WaitForLatestSnapshot(revision): |
384 util.MarkBuildStepStart('wait_for_snapshot') | 404 util.MarkBuildStepStart('wait_for_snapshot') |
385 while True: | 405 while True: |
386 snapshot_revision = archive.GetLatestSnapshotVersion() | 406 snapshot_revision = archive.GetLatestSnapshotVersion() |
387 if int(snapshot_revision) >= int(revision): | 407 if not revision.isdigit(): |
388 break | 408 revision = _GetSVNRevisionFromGitHash(revision) |
389 util.PrintAndFlush('Waiting for snapshot >= %s, found %s' % | 409 if not snapshot_revision.isdigit(): |
390 (revision, snapshot_revision)) | 410 snapshot_revision = _GetSVNRevisionFromGitHash(snapshot_revision) |
| 411 if revision is not None and snapshot_revision is not None: |
| 412 if int(snapshot_revision) >= int(revision): |
| 413 break |
| 414 util.PrintAndFlush('Waiting for snapshot >= %s, found %s' % |
| 415 (revision, snapshot_revision)) |
391 time.sleep(60) | 416 time.sleep(60) |
392 util.PrintAndFlush('Got snapshot revision %s' % snapshot_revision) | 417 util.PrintAndFlush('Got snapshot revision %s' % snapshot_revision) |
393 | 418 |
394 | 419 |
395 def _AddToolsToPath(platform_name): | 420 def _AddToolsToPath(platform_name): |
396 """Add some tools like Ant and Java to PATH for testing steps to use.""" | 421 """Add some tools like Ant and Java to PATH for testing steps to use.""" |
397 paths = [] | 422 paths = [] |
398 error_message = '' | 423 error_message = '' |
399 if platform_name == 'win32': | 424 if platform_name == 'win32': |
400 paths = [ | 425 paths = [ |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 util.MarkBuildStepStart('run_all_tests.py') | 506 util.MarkBuildStepStart('run_all_tests.py') |
482 util.MarkBuildStepError() | 507 util.MarkBuildStepError() |
483 | 508 |
484 # Add a "cleanup" step so that errors from runtest.py or bb_device_steps.py | 509 # Add a "cleanup" step so that errors from runtest.py or bb_device_steps.py |
485 # (which invoke this script) are kept in thier own build step. | 510 # (which invoke this script) are kept in thier own build step. |
486 util.MarkBuildStepStart('cleanup') | 511 util.MarkBuildStepStart('cleanup') |
487 | 512 |
488 | 513 |
489 if __name__ == '__main__': | 514 if __name__ == '__main__': |
490 main() | 515 main() |
OLD | NEW |