| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/python | |
| 2 | |
| 3 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 """Dartium buildbot steps | |
| 8 | |
| 9 Archive dartium, content_shell, and chromedriver to the cloud storage bucket | |
| 10 gs://dart-archive, and run tests, including the Dart layout tests. | |
| 11 """ | |
| 12 | |
| 13 import imp | |
| 14 import os | |
| 15 import platform | |
| 16 import re | |
| 17 import shutil | |
| 18 import subprocess | |
| 19 import sys | |
| 20 | |
| 21 import dartium_bot_utils | |
| 22 import upload_steps | |
| 23 import utils | |
| 24 | |
| 25 SRC_PATH = dartium_bot_utils.srcPath() | |
| 26 DART_PATH = os.path.join(SRC_PATH, 'dart') | |
| 27 | |
| 28 # We limit testing on drt since it takes a long time to run. | |
| 29 DRT_FILTER = 'html' | |
| 30 | |
| 31 def RunDartTests(mode, component, suite, arch, checked, test_filter=None): | |
| 32 """Runs tests using the Dart test.py or the layout test runner. | |
| 33 """ | |
| 34 cmd = [] | |
| 35 if sys.platform.startswith('linux'): | |
| 36 cmd = ['xvfb-run', '--server-args=-screen 0 1024x768x24','-a'] | |
| 37 cmd.append(sys.executable) | |
| 38 script = os.path.join(DART_PATH, 'tools', 'dartium', 'test.py') | |
| 39 cmd.append(script) | |
| 40 cmd.append('--buildbot') | |
| 41 cmd.append('--mode=' + mode) | |
| 42 cmd.append('--component=' + component) | |
| 43 cmd.append('--suite=' + suite) | |
| 44 cmd.append('--arch=' + arch) | |
| 45 cmd.append('--' + checked) | |
| 46 cmd.append('--no-show-results') | |
| 47 | |
| 48 if test_filter: | |
| 49 cmd.append('--test-filter=' + test_filter) | |
| 50 | |
| 51 status = subprocess.call(cmd) | |
| 52 if status != 0: | |
| 53 print '@@@STEP_FAILURE@@@' | |
| 54 return status | |
| 55 | |
| 56 def ClearTemp(): | |
| 57 if platform.system() == 'Windows': | |
| 58 shutil.rmtree('C:\\Users\\chrome-bot\\AppData\\Local\\Temp', | |
| 59 ignore_errors=True) | |
| 60 | |
| 61 def Test(info, component, suite, checked, test_filter=None): | |
| 62 """Test a particular component (e.g., dartium or content_shell(drt)). | |
| 63 """ | |
| 64 print '@@@BUILD_STEP %s_%s_%s_tests@@@' % (component, suite, checked) | |
| 65 sys.stdout.flush() | |
| 66 layout_test_results_dir = os.path.join(SRC_PATH, 'webkit', info.mode, | |
| 67 'layout-test-results') | |
| 68 shutil.rmtree(layout_test_results_dir, ignore_errors=True) | |
| 69 status = RunDartTests(info.mode, component, suite, info.arch, checked, | |
| 70 test_filter=test_filter) | |
| 71 # Archive test failures | |
| 72 if suite == 'layout' and status != 0: | |
| 73 upload_steps.UploadDartTestsResults(layout_test_results_dir, | |
| 74 info.name, | |
| 75 info.version, | |
| 76 component, checked) | |
| 77 ClearTemp() | |
| 78 return status | |
| 79 | |
| 80 | |
| 81 def main(): | |
| 82 # We need to chdir() to src/dart in order to get the correct revision number. | |
| 83 with utils.ChangedWorkingDirectory(DART_PATH): | |
| 84 dart_tools_utils = imp.load_source('dart_tools_utils', | |
| 85 os.path.join('tools', 'utils.py')) | |
| 86 dart_revision = dart_tools_utils.GetArchiveVersion() | |
| 87 | |
| 88 version = '%s.0' % dart_revision | |
| 89 info = upload_steps.BuildInfo(dart_revision, version) | |
| 90 | |
| 91 result = 0 | |
| 92 | |
| 93 # Archive to the revision bucket | |
| 94 result = upload_steps.ArchiveAndUpload(info, archive_latest=False) | |
| 95 # On dev/stable we archive to the latest bucket as well | |
| 96 if info.channel != 'be': | |
| 97 result = (upload_steps.ArchiveAndUpload(info, archive_latest=True) | |
| 98 or result) | |
| 99 | |
| 100 # Run layout tests | |
| 101 if info.mode == 'Release' or platform.system() != 'Darwin': | |
| 102 result = Test(info, 'drt', 'layout', 'unchecked') or result | |
| 103 result = Test(info, 'drt', 'layout', 'checked') or result | |
| 104 # Run dartium tests | |
| 105 result = Test(info, 'dartium', 'core', 'unchecked') or result | |
| 106 result = Test(info, 'dartium', 'core', 'checked') or result | |
| 107 | |
| 108 # Run ContentShell tests | |
| 109 # NOTE: We don't run ContentShell tests on dartium-*-inc builders to keep | |
| 110 # cycle times down. | |
| 111 if not info.is_incremental: | |
| 112 # If we run all checked tests on dartium, we restrict the number of | |
| 113 # unchecked tests on drt to DRT_FILTER | |
| 114 result = Test(info, 'drt', 'core', 'unchecked', | |
| 115 test_filter=DRT_FILTER) or result | |
| 116 result = Test(info, 'drt', 'core', 'checked') or result | |
| 117 | |
| 118 # On the 'be' channel, we only archive to the latest bucket if all tests were | |
| 119 # successful. | |
| 120 if result == 0 and info.channel == 'be': | |
| 121 result = upload_steps.ArchiveAndUpload(info, archive_latest=True) or result | |
| 122 return result | |
| 123 | |
| 124 if __name__ == '__main__': | |
| 125 sys.exit(main()) | |
| OLD | NEW |