Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 3 # for details. All rights reserved. Use of this source code is governed by a | |
| 4 # BSD-style license that can be found in the LICENSE file. | |
| 5 | |
| 6 import os | |
| 7 import re | |
| 8 import shutil | |
| 9 import sys | |
| 10 import tempfile | |
| 11 | |
| 12 import bot | |
| 13 | |
| 14 GCS_BUCKET = 'gs://dart-misc' | |
|
kustermann
2013/05/17 07:58:13
I'm not sure which bucket we should use.
| |
| 15 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| 16 sys.path.append(os.path.join(SCRIPT_DIR, '..')) | |
| 17 | |
| 18 import utils | |
| 19 | |
| 20 CROSS_VM = r'cross-(arm)-vm-linux-(release)' | |
| 21 TARGET_VM = r'target-(arm)-vm-linux-(release)' | |
| 22 GSUTIL = utils.GetBuildbotGSUtilPath() | |
| 23 GSUTIL = 'gsutil' | |
| 24 | |
| 25 def run(args): | |
| 26 print 'Running: %s' % (' '.join(args)) | |
| 27 sys.stdout.flush() | |
| 28 bot.RunProcess(args) | |
| 29 | |
| 30 def main(): | |
| 31 name, is_buildbot = bot.GetBotName() | |
| 32 build_py = os.path.join('tools', 'build.py') | |
| 33 test_py = os.path.join('tools', 'test.py') | |
| 34 | |
| 35 cross_vm_pattern_match = re.match(CROSS_VM, name) | |
| 36 target_vm_pattern_match = re.match(TARGET_VM, name) | |
| 37 if cross_vm_pattern_match: | |
| 38 arch = cross_vm_pattern_match.group(1) | |
| 39 mode = cross_vm_pattern_match.group(2) | |
| 40 | |
| 41 bot.Clobber() | |
| 42 with bot.BuildStep('Build %s %s' % (arch, mode)): | |
| 43 args = [sys.executable, build_py, | |
| 44 '-m%s' % mode, '--arch=%s' % arch, 'runtime'] | |
| 45 run(args) | |
| 46 | |
| 47 tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode) | |
| 48 try: | |
| 49 with bot.BuildStep('Create build tarball'): | |
| 50 run(['tarj', '-cjf', tarball, '--exclude=**/obj', | |
| 51 '--exclude=**/obj.host', '--exclude=**/obj.target', | |
| 52 '--exclude=**/*analyzer*', 'out/']) | |
| 53 | |
| 54 with bot.BuildStep('Upload build tarball'): | |
| 55 run([GSUTIL, 'cp', tarball, "%s/%s" % (GCS_BUCKET, tarball)]) | |
| 56 finally: | |
| 57 if os.path.exists(tarball): | |
| 58 os.remove(tarball) | |
| 59 elif target_vm_pattern_match: | |
| 60 arch = target_vm_pattern_match.group(1) | |
| 61 mode = target_vm_pattern_match.group(2) | |
| 62 | |
| 63 bot.Clobber() | |
| 64 tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode) | |
| 65 try: | |
| 66 test_args = [sys.executable, test_py, '--progress=line', '--report', | |
| 67 '--time', '--mode=' + mode, '--arch=' + arch, '--compiler=none', | |
| 68 '--runtime=vm', '--write-debug-log'] | |
| 69 | |
| 70 with bot.BuildStep('Fetch build tarball'): | |
| 71 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) | |
| 72 | |
| 73 with bot.BuildStep('Unpack build tarball'): | |
| 74 run(['tar', '-xjf', tarball]) | |
| 75 | |
| 76 with bot.BuildStep('tests'): | |
| 77 run(test_args) | |
| 78 | |
| 79 with bot.BuildStep('checked_tests'): | |
| 80 run(test_args + ['--checked']) | |
|
kustermann
2013/05/17 07:58:13
These two steps won't work yet, since we don't hav
| |
| 81 finally: | |
| 82 if os.path.exists(tarball): | |
| 83 os.remove(tarball) | |
| 84 else: | |
| 85 raise Exception("Unknown builder name %s" % name) | |
| 86 | |
| 87 if __name__ == '__main__': | |
| 88 sys.exit(main()) | |
| OLD | NEW |