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' | |
ricow1
2013/05/17 08:19:07
dart-cross-compiled-binaries?
kustermann
2013/05/17 09:34:23
Done.
| |
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 | |
24 def run(args): | |
25 print 'Running: %s' % (' '.join(args)) | |
26 sys.stdout.flush() | |
27 bot.RunProcess(args) | |
28 | |
29 def main(): | |
30 name, is_buildbot = bot.GetBotName() | |
31 build_py = os.path.join('tools', 'build.py') | |
32 test_py = os.path.join('tools', 'test.py') | |
33 | |
34 cross_vm_pattern_match = re.match(CROSS_VM, name) | |
35 target_vm_pattern_match = re.match(TARGET_VM, name) | |
36 if cross_vm_pattern_match: | |
37 arch = cross_vm_pattern_match.group(1) | |
38 mode = cross_vm_pattern_match.group(2) | |
39 | |
40 bot.Clobber() | |
ricow1
2013/05/17 08:19:07
why do we clobber here?
kustermann
2013/05/17 09:34:23
We don't clobber, we call a 'bot.clobber()' which
| |
41 with bot.BuildStep('Build %s %s' % (arch, mode)): | |
42 args = [sys.executable, build_py, | |
43 '-m%s' % mode, '--arch=%s' % arch, 'runtime'] | |
44 run(args) | |
45 | |
46 tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode) | |
47 try: | |
48 with bot.BuildStep('Create build tarball'): | |
49 run(['tarj', '-cjf', tarball, '--exclude=**/obj', | |
50 '--exclude=**/obj.host', '--exclude=**/obj.target', | |
51 '--exclude=**/*analyzer*', 'out/']) | |
52 | |
53 with bot.BuildStep('Upload build tarball'): | |
ricow1
2013/05/17 08:19:07
I would, in addition to this, actually set the pub
kustermann
2013/05/17 09:34:23
Done.
| |
54 run([GSUTIL, 'cp', tarball, "%s/%s" % (GCS_BUCKET, tarball)]) | |
55 finally: | |
56 if os.path.exists(tarball): | |
57 os.remove(tarball) | |
58 elif target_vm_pattern_match: | |
59 arch = target_vm_pattern_match.group(1) | |
60 mode = target_vm_pattern_match.group(2) | |
61 | |
62 bot.Clobber() | |
63 tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode) | |
64 try: | |
65 test_args = [sys.executable, test_py, '--progress=line', '--report', | |
66 '--time', '--mode=' + mode, '--arch=' + arch, '--compiler=none', | |
67 '--runtime=vm', '--write-debug-log'] | |
68 | |
69 with bot.BuildStep('Fetch build tarball'): | |
70 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball]) | |
71 | |
72 with bot.BuildStep('Unpack build tarball'): | |
73 run(['tar', '-xjf', tarball]) | |
74 | |
75 with bot.BuildStep('tests'): | |
76 run(test_args) | |
77 | |
78 with bot.BuildStep('checked_tests'): | |
79 run(test_args + ['--checked']) | |
80 finally: | |
81 if os.path.exists(tarball): | |
82 os.remove(tarball) | |
83 else: | |
84 raise Exception("Unknown builder name %s" % name) | |
85 | |
86 if __name__ == '__main__': | |
87 sys.exit(main()) | |
OLD | NEW |