Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, 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 import imp | 7 import imp |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import shutil | 10 import shutil |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 local_zip = os.path.join(build_root, 'sdk.zip') | 171 local_zip = os.path.join(build_root, 'sdk.zip') |
| 172 gsutils = bot_utils.GSUtil() | 172 gsutils = bot_utils.GSUtil() |
| 173 gsutils.execute(['cp', | 173 gsutils.execute(['cp', |
| 174 namer.sdk_zipfilepath('latest', bot_info.system, | 174 namer.sdk_zipfilepath('latest', bot_info.system, |
| 175 'ia32', 'release'), | 175 'ia32', 'release'), |
| 176 local_zip]) | 176 local_zip]) |
| 177 if bot_info.system == 'windows': | 177 if bot_info.system == 'windows': |
| 178 with zipfile.ZipFile(local_zip, 'r') as zip_file: | 178 with zipfile.ZipFile(local_zip, 'r') as zip_file: |
| 179 zip_file.extractall(path=build_root) | 179 zip_file.extractall(path=build_root) |
| 180 else: | 180 else: |
| 181 # We don't keep the execution bit if we use python's zipfile on possix. | 181 # We don't keep the execution bit if we use python's zipfile on posix. |
| 182 RunProcess(['unzip', local_zip, '-d', build_root]) | 182 RunProcess(['unzip', local_zip, '-d', build_root]) |
| 183 pub = GetPub(bot_info) | 183 pub = GetPub(bot_info) |
| 184 RunProcess([pub, '--version']) | 184 RunProcess([pub, '--version']) |
| 185 | 185 |
| 186 def GetPackagePath(bot_info): | 186 def GetPackagePath(bot_info): |
| 187 if bot_info.is_repo: | 187 if bot_info.is_repo: |
| 188 return os.path.join('pkg', bot_info.package_name) | 188 return os.path.join('pkg', bot_info.package_name) |
| 189 return os.path.join('third_party', 'pkg', bot_info.package_name) | 189 return os.path.join('third_party', 'pkg', bot_info.package_name) |
| 190 | 190 |
| 191 def GetBuildRoot(bot_info): | 191 def GetBuildRoot(bot_info): |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 print '- ok: ' if exists else '- bad: ', | 260 print '- ok: ' if exists else '- bad: ', |
| 261 print os.path.join(package, 'lib', 'unittest.dart') | 261 print os.path.join(package, 'lib', 'unittest.dart') |
| 262 print '' | 262 print '' |
| 263 | 263 |
| 264 def RunPubUpgrade(bot_info, path): | 264 def RunPubUpgrade(bot_info, path): |
| 265 pub = GetPub(bot_info) | 265 pub = GetPub(bot_info) |
| 266 extra_env = GetPubEnv(bot_info) | 266 extra_env = GetPubEnv(bot_info) |
| 267 with BuildStep('Pub upgrade'): | 267 with BuildStep('Pub upgrade'): |
| 268 # For now, assume pub | 268 # For now, assume pub |
| 269 with ChangedWorkingDirectory(path): | 269 with ChangedWorkingDirectory(path): |
| 270 args = [pub, 'upgrade'] | 270 args = [pub, 'upgrade', '--no-package-symlinks'] |
| 271 RunProcess(args, extra_env=extra_env) | 271 RunProcess(args, extra_env=extra_env) |
| 272 | 272 |
| 273 def RunPubBuild(bot_info, path, folder, mode=None): | 273 def RunPubBuild(bot_info, path, folder, mode=None): |
| 274 skip_pub_build = ['dart-protobuf', 'rpc'] | 274 skip_pub_build = ['dart-protobuf', 'rpc'] |
| 275 with BuildStep('Pub build on %s' % folder): | 275 with BuildStep('Pub build on %s' % folder): |
| 276 if bot_info.package_name in skip_pub_build: | 276 if bot_info.package_name in skip_pub_build: |
| 277 print "Not running pub build" | 277 print "Not running pub build" |
| 278 return | 278 return |
| 279 pub = GetPub(bot_info) | 279 pub = GetPub(bot_info) |
| 280 extra_env = GetPubEnv(bot_info) | 280 extra_env = GetPubEnv(bot_info) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 if is_first_test_run: | 313 if is_first_test_run: |
| 314 is_first_test_run = False | 314 is_first_test_run = False |
| 315 return [] | 315 return [] |
| 316 return ['--append_logs'] | 316 return ['--append_logs'] |
| 317 | 317 |
| 318 def RunPackageTesting(bot_info, package_path, folder='test'): | 318 def RunPackageTesting(bot_info, package_path, folder='test'): |
| 319 package_name = os.path.basename(package_path) | 319 package_name = os.path.basename(package_path) |
| 320 if package_name == '': | 320 if package_name == '': |
| 321 # when package_path had a trailing slash | 321 # when package_path had a trailing slash |
| 322 package_name = os.path.basename(os.path.dirname(package_path)) | 322 package_name = os.path.basename(os.path.dirname(package_path)) |
| 323 package_root = os.path.join(package_path, folder, 'packages') | 323 package_spec_file = os.path.join(package_path, folder, '.packages') |
| 324 | 324 |
| 325 # Note: we use package_name/package_name/folder and not package_name/folder on | 325 # Note: we use package_name/package_name/folder and not package_name/folder on |
|
mit
2016/08/12 12:02:31
Should update this comment
Bill Hesse
2016/08/12 12:06:00
The comment does not apply to the changed package
| |
| 326 # purpose. The first package_name denotes the suite, the second is part of the | 326 # purpose. The first package_name denotes the suite, the second is part of the |
| 327 # path we want to match. Without the second package_name, we may match tests | 327 # path we want to match. Without the second package_name, we may match tests |
| 328 # that contain "folder" further down. So if folder is "test", | 328 # that contain "folder" further down. So if folder is "test", |
| 329 # "package_name/test" matches "package_name/build/test", but | 329 # "package_name/test" matches "package_name/build/test", but |
| 330 # "package_name/package_name/test" does not. | 330 # "package_name/package_name/test" does not. |
| 331 standard_args = ['--arch=ia32', | 331 standard_args = ['--arch=ia32', |
| 332 '--suite-dir=%s' % package_path, | 332 '--suite-dir=%s' % package_path, |
| 333 '--use-sdk', '--report', '--progress=buildbot', | 333 '--use-sdk', '--report', '--progress=buildbot', |
| 334 '--clear_browser_cache', | 334 '--clear_browser_cache', |
| 335 '--package-root=%s' % package_root, | 335 '--packages=%s' % package_spec_file, |
| 336 '--write-debug-log', '-v', | 336 '--write-debug-log', '-v', |
| 337 '--time', | 337 '--time', |
| 338 '%s/%s/%s/' % (package_name, package_name, folder)] | 338 '%s/%s/%s/' % (package_name, package_name, folder)] |
| 339 suffix = ' under build' if folder == 'build/test' else '' | 339 suffix = ' under build' if folder == 'build/test' else '' |
| 340 with BuildStep('Test vm release mode%s' % suffix, swallow_error=True): | 340 with BuildStep('Test vm release mode%s' % suffix, swallow_error=True): |
| 341 args = [sys.executable, 'tools/test.py', | 341 args = [sys.executable, 'tools/test.py', |
| 342 '-mrelease', '-rvm', '-cnone'] + standard_args | 342 '-mrelease', '-rvm', '-cnone'] + standard_args |
| 343 args.extend(LogsArgument()) | 343 args.extend(LogsArgument()) |
| 344 # For easy integration testing we give access to the sdk bin directory. | 344 # For easy integration testing we give access to the sdk bin directory. |
| 345 # This only makes sense on vm testing. | 345 # This only makes sense on vm testing. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 374 raise Exception("Unknown magic marker %s. Known mappings are: %s" % | 374 raise Exception("Unknown magic marker %s. Known mappings are: %s" % |
| 375 (word, replacements)) | 375 (word, replacements)) |
| 376 return replacements[word] | 376 return replacements[word] |
| 377 return re.sub(r"\$(\w+)", replace, v) | 377 return re.sub(r"\$(\w+)", replace, v) |
| 378 | 378 |
| 379 def RunTestRunner(bot_info, test_package, package_path): | 379 def RunTestRunner(bot_info, test_package, package_path): |
| 380 package_name = os.path.basename(package_path) | 380 package_name = os.path.basename(package_path) |
| 381 if package_name == '': | 381 if package_name == '': |
| 382 # when package_path had a trailing slash | 382 # when package_path had a trailing slash |
| 383 package_name = os.path.basename(os.path.dirname(package_path)) | 383 package_name = os.path.basename(os.path.dirname(package_path)) |
| 384 package_root = os.path.join(package_path, 'packages') | |
| 385 | 384 |
| 386 pub = GetPub(bot_info) | 385 pub = GetPub(bot_info) |
| 387 extra_env = GetPubEnv(bot_info) | 386 extra_env = GetPubEnv(bot_info) |
| 388 with BuildStep('pub run test', swallow_error=True): | 387 with BuildStep('pub run test', swallow_error=True): |
| 389 # TODO(nweiz): include dartium here once sdk#23816 is fixed. | 388 # TODO(nweiz): include dartium here once sdk#23816 is fixed. |
| 390 platforms = set(['vm', 'chrome', 'firefox']) | 389 platforms = set(['vm', 'chrome', 'firefox']) |
| 391 if bot_info.system == 'windows': | 390 if bot_info.system == 'windows': |
| 392 platforms.add('ie') | 391 platforms.add('ie') |
| 393 # TODO(nweiz): remove dartium here once sdk#23816 is fixed. | 392 # TODO(nweiz): remove dartium here once sdk#23816 is fixed. |
| 394 elif bot_info.system == 'mac': | 393 elif bot_info.system == 'mac': |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 'dart': utils.CheckedInSdkExecutable(), | 497 'dart': utils.CheckedInSdkExecutable(), |
| 499 'project_root': copy_path, | 498 'project_root': copy_path, |
| 500 'python': sys.executable | 499 'python': sys.executable |
| 501 } | 500 } |
| 502 | 501 |
| 503 RunCustomScript(test_config) or \ | 502 RunCustomScript(test_config) or \ |
| 504 RunDefaultScript(bot_info, test_config, copy_path) | 503 RunDefaultScript(bot_info, test_config, copy_path) |
| 505 | 504 |
| 506 if __name__ == '__main__': | 505 if __name__ == '__main__': |
| 507 main() | 506 main() |
| OLD | NEW |