| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 import bot | 10 import bot |
| 11 | 11 |
| 12 GCS_BUCKET = 'gs://dart-cross-compiled-binaries' | 12 GCS_BUCKET = 'gs://dart-cross-compiled-binaries' |
| 13 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 13 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 14 sys.path.append(os.path.join(SCRIPT_DIR, '..')) | 14 sys.path.append(os.path.join(SCRIPT_DIR, '..')) |
| 15 | 15 |
| 16 import utils | 16 import utils |
| 17 | 17 |
| 18 CROSS_VM = r'cross-(arm)-vm-linux-(release)' | 18 CROSS_VM = r'cross-(arm)-vm-linux-(release)' |
| 19 TARGET_VM = r'target-(arm)-vm-linux-(release)' | 19 TARGET_VM = r'target-(arm)-vm-linux-(release)' |
| 20 GSUTIL = utils.GetBuildbotGSUtilPath() | 20 GSUTIL = utils.GetBuildbotGSUtilPath() |
| 21 | 21 |
| 22 def run(args): | 22 def run(args): |
| 23 print 'Running: %s' % (' '.join(args)) | 23 print 'Running: %s' % (' '.join(args)) |
| 24 sys.stdout.flush() | 24 sys.stdout.flush() |
| 25 bot.RunProcess(args) | 25 bot.RunProcess(args) |
| 26 | 26 |
| 27 def tarball_name(arch, mode): | 27 def tarball_name(arch, mode, revision): |
| 28 return 'cross_build_%s_%s.tar.bz2' % (arch, mode) | 28 return 'cross_build_%s_%s_%s.tar.bz2' % (arch, mode, revision) |
| 29 | 29 |
| 30 def record_names(name, arch, mode): | 30 def record_names(name, arch, mode): |
| 31 return ('record_%s_%s_%s.json' % (name, arch, mode), | 31 return ('record_%s_%s_%s.json' % (name, arch, mode), |
| 32 'record_output_%s_%s_%s.json' % (name, arch, mode)) | 32 'record_output_%s_%s_%s.json' % (name, arch, mode)) |
| 33 | 33 |
| 34 def cross_compiling_builder(arch, mode): | 34 def cross_compiling_builder(arch, mode): |
| 35 build_py = os.path.join('tools', 'build.py') | 35 build_py = os.path.join('tools', 'build.py') |
| 36 | 36 revision = int(os.environ['BUILDBOT_GOT_REVISION']) |
| 37 tarball = tarball_name(arch, mode) | 37 tarball = tarball_name(arch, mode, revision) |
| 38 temporary_files = [tarball] | 38 temporary_files = [tarball] |
| 39 bot.Clobber() | 39 bot.Clobber() |
| 40 try: | 40 try: |
| 41 num_run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN']) | 41 num_run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN']) |
| 42 if num_run == 1: | 42 if num_run == 1: |
| 43 with bot.BuildStep('Build %s %s' % (arch, mode)): | 43 with bot.BuildStep('Build %s %s' % (arch, mode)): |
| 44 run([sys.executable, build_py, | 44 run([sys.executable, build_py, |
| 45 '-m%s' % mode, '--arch=%s' % arch, 'runtime']) | 45 '-m%s' % mode, '--arch=%s' % arch, 'runtime']) |
| 46 # We need to build 'run_vm_tests.host' as well to enable | 46 # We need to build 'run_vm_tests.host' as well to enable |
| 47 # test.py to list the VM tests. | 47 # test.py to list the VM tests. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 69 for path in temporary_files: | 69 for path in temporary_files: |
| 70 if os.path.exists(path): | 70 if os.path.exists(path): |
| 71 os.remove(path) | 71 os.remove(path) |
| 72 | 72 |
| 73 def target_builder(arch, mode): | 73 def target_builder(arch, mode): |
| 74 test_py = os.path.join('tools', 'test.py') | 74 test_py = os.path.join('tools', 'test.py') |
| 75 test_args = [sys.executable, test_py, '--progress=line', '--report', | 75 test_args = [sys.executable, test_py, '--progress=line', '--report', |
| 76 '--time', '--compiler=none', '--runtime=vm', '--write-debug-log', | 76 '--time', '--compiler=none', '--runtime=vm', '--write-debug-log', |
| 77 '--mode=' + mode, '--arch=' + arch] | 77 '--mode=' + mode, '--arch=' + arch] |
| 78 | 78 |
| 79 tarball = tarball_name(arch, mode) | 79 revision = int(os.environ['BUILDBOT_GOT_REVISION']) |
| 80 tarball = tarball_name(arch, mode, revision) |
| 80 temporary_files = [tarball] | 81 temporary_files = [tarball] |
| 81 bot.Clobber() | 82 bot.Clobber() |
| 82 try: | 83 try: |
| 83 with bot.BuildStep('Fetch build tarball'): | 84 with bot.BuildStep('Fetch build tarball'): |
| 84 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) | 85 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) |
| 85 | 86 |
| 86 with bot.BuildStep('Unpack build tarball'): | 87 with bot.BuildStep('Unpack build tarball'): |
| 87 run(['tar', '-xjf', tarball]) | 88 run(['tar', '-xjf', tarball]) |
| 88 | 89 |
| 89 with bot.BuildStep('execute tests'): | 90 with bot.BuildStep('execute tests'): |
| (...skipping 20 matching lines...) Expand all Loading... |
| 110 mode = target_vm_pattern_match.group(2) | 111 mode = target_vm_pattern_match.group(2) |
| 111 target_builder(arch, mode) | 112 target_builder(arch, mode) |
| 112 else: | 113 else: |
| 113 raise Exception("Unknown builder name %s" % name) | 114 raise Exception("Unknown builder name %s" % name) |
| 114 | 115 |
| 115 if __name__ == '__main__': | 116 if __name__ == '__main__': |
| 116 try: | 117 try: |
| 117 sys.exit(main()) | 118 sys.exit(main()) |
| 118 except OSError as e: | 119 except OSError as e: |
| 119 sys.exit(e.errno) | 120 sys.exit(e.errno) |
| OLD | NEW |