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-(([0-9]+)-([0-9]+))?(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, revision): | 27 def tarball_name(arch, mode, revision): |
28 return 'cross_build_%s_%s_%s.tar.bz2' % (arch, mode, revision) | 28 return 'cross_build_%s_%s_%s.tar.bz2' % (arch, mode, revision) |
29 | 29 |
(...skipping 28 matching lines...) Expand all Loading... |
58 with bot.BuildStep('tests'): | 58 with bot.BuildStep('tests'): |
59 print "Please see the target device for results." | 59 print "Please see the target device for results." |
60 print "We no longer record/replay tests." | 60 print "We no longer record/replay tests." |
61 else: | 61 else: |
62 raise Exception("Invalid annotated steps run") | 62 raise Exception("Invalid annotated steps run") |
63 finally: | 63 finally: |
64 for path in temporary_files: | 64 for path in temporary_files: |
65 if os.path.exists(path): | 65 if os.path.exists(path): |
66 os.remove(path) | 66 os.remove(path) |
67 | 67 |
68 def target_builder(arch, mode): | 68 def target_builder(arch, mode, total_shards, shard_index): |
69 test_py = os.path.join('tools', 'test.py') | 69 test_py = os.path.join('tools', 'test.py') |
70 test_args = [sys.executable, test_py, '--progress=line', '--report', | 70 test_args = [sys.executable, test_py, '--progress=line', '--report', |
71 '--time', '--compiler=none', '--runtime=vm', '--write-debug-log', | 71 '--time', '--compiler=none', '--runtime=vm', '--write-debug-log', |
72 '--write-test-outcome-log', '--mode=' + mode, '--arch=' + arch, | 72 '--write-test-outcome-log', '--mode=' + mode, '--arch=' + arch, |
73 '--exclude-suite=pkg'] | 73 '--exclude-suite=pkg'] |
| 74 if total_shards and shard_index: |
| 75 test_args.append('--shards=%s' % total_shards) |
| 76 test_args.append('--shard=%s' % shard_index) |
74 | 77 |
75 revision = os.environ['BUILDBOT_GOT_REVISION'] | 78 revision = os.environ['BUILDBOT_GOT_REVISION'] |
76 tarball = tarball_name(arch, mode, revision) | 79 tarball = tarball_name(arch, mode, revision) |
77 temporary_files = [tarball] | 80 temporary_files = [tarball] |
78 bot.Clobber() | 81 bot.Clobber() |
79 try: | 82 try: |
80 with bot.BuildStep('Fetch build tarball'): | 83 with bot.BuildStep('Fetch build tarball'): |
81 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) | 84 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) |
82 | 85 |
83 with bot.BuildStep('Unpack build tarball'): | 86 with bot.BuildStep('Unpack build tarball'): |
(...skipping 15 matching lines...) Expand all Loading... |
99 name, is_buildbot = bot.GetBotName() | 102 name, is_buildbot = bot.GetBotName() |
100 | 103 |
101 cross_vm_pattern_match = re.match(CROSS_VM, name) | 104 cross_vm_pattern_match = re.match(CROSS_VM, name) |
102 target_vm_pattern_match = re.match(TARGET_VM, name) | 105 target_vm_pattern_match = re.match(TARGET_VM, name) |
103 if cross_vm_pattern_match: | 106 if cross_vm_pattern_match: |
104 arch = cross_vm_pattern_match.group(1) | 107 arch = cross_vm_pattern_match.group(1) |
105 mode = cross_vm_pattern_match.group(2) | 108 mode = cross_vm_pattern_match.group(2) |
106 cross_compiling_builder(arch, mode) | 109 cross_compiling_builder(arch, mode) |
107 elif target_vm_pattern_match: | 110 elif target_vm_pattern_match: |
108 arch = target_vm_pattern_match.group(1) | 111 arch = target_vm_pattern_match.group(1) |
109 mode = target_vm_pattern_match.group(2) | 112 mode = target_vm_pattern_match.group(5) |
110 target_builder(arch, mode) | 113 shard_index = target_vm_pattern_match.group(3) |
| 114 total_shards = target_vm_pattern_match.group(4) |
| 115 target_builder(arch, mode, total_shards, shard_index) |
111 else: | 116 else: |
112 raise Exception("Unknown builder name %s" % name) | 117 raise Exception("Unknown builder name %s" % name) |
113 | 118 |
114 if __name__ == '__main__': | 119 if __name__ == '__main__': |
115 try: | 120 try: |
116 sys.exit(main()) | 121 sys.exit(main()) |
117 except OSError as e: | 122 except OSError as e: |
118 sys.exit(e.errno) | 123 sys.exit(e.errno) |
OLD | NEW |