Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tools/bots/cross-vm.py

Issue 2895973002: Remove old annotated_steps buildbot scripts and dispatcher (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/bots/compiler.py ('k') | tools/bots/dartium_android.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 sys
9
10 import bot
11
12 GCS_BUCKET = 'gs://dart-cross-compiled-binaries'
13 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
14 sys.path.append(os.path.join(SCRIPT_DIR, '..'))
15
16 import utils
17
18 CROSS_VM = r'cross-(arm)-vm-linux-(release)'
19 TARGET_VM = r'target-(arm)-vm-linux-(([0-9]+)-([0-9]+))?(release)'
20 GSUTIL = utils.GetBuildbotGSUtilPath()
21
22 def run(args):
23 print 'Running: %s' % (' '.join(args))
24 sys.stdout.flush()
25 bot.RunProcess(args)
26
27 def tarball_name(arch, mode, revision):
28 return 'cross_build_%s_%s_%s.tar.bz2' % (arch, mode, revision)
29
30 def record_names(name, arch, mode):
31 return ('record_%s_%s_%s.json' % (name, arch, mode),
32 'record_output_%s_%s_%s.json' % (name, arch, mode))
33
34 def cross_compiling_builder(arch, mode):
35 build_py = os.path.join('tools', 'build.py')
36 revision = os.environ['BUILDBOT_GOT_REVISION']
37 tarball = tarball_name(arch, mode, revision)
38 temporary_files = [tarball]
39 bot.Clobber()
40 try:
41 num_run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN'])
42 if num_run == 1:
43 with bot.BuildStep('Build %s %s' % (arch, mode)):
44 run([sys.executable, build_py,
45 '-m%s' % mode, '--arch=%s' % arch, 'runtime'])
46
47 with bot.BuildStep('Create build tarball'):
48 run(['tar', '-cjf', tarball, '--exclude=**/obj',
49 '--exclude=**/obj.host', '--exclude=**/obj.target',
50 '--exclude=**/*analyzer*', 'out/'])
51
52 with bot.BuildStep('Upload build tarball'):
53 uri = "%s/%s" % (GCS_BUCKET, tarball)
54 run([GSUTIL, 'cp', '-a', 'public-read', tarball, uri])
55
56 elif num_run == 2:
57 with bot.BuildStep('tests'):
58 print "Please see the target device for results."
59 print "We no longer record/replay tests."
60 else:
61 raise Exception("Invalid annotated steps run")
62 finally:
63 for path in temporary_files:
64 if os.path.exists(path):
65 os.remove(path)
66
67 def target_builder(arch, mode, total_shards, shard_index):
68 test_py = os.path.join('tools', 'test.py')
69 test_args = [sys.executable, test_py, '--progress=line', '--report',
70 '--time', '--compiler=none', '--runtime=vm', '--write-debug-log',
71 '--write-test-outcome-log', '--mode=' + mode, '--arch=' + arch]
72 if total_shards and shard_index:
73 test_args.append('--shards=%s' % total_shards)
74 test_args.append('--shard=%s' % shard_index)
75
76 revision = os.environ['BUILDBOT_GOT_REVISION']
77 tarball = tarball_name(arch, mode, revision)
78 temporary_files = [tarball]
79 bot.Clobber()
80 try:
81 with bot.BuildStep('Fetch build tarball'):
82 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball])
83
84 with bot.BuildStep('Unpack build tarball'):
85 run(['tar', '-xjf', tarball])
86
87 with bot.BuildStep('execute tests'):
88 run(test_args)
89
90 with bot.BuildStep('execute checked_tests'):
91 run(test_args + ['--checked', '--append_logs'])
92 finally:
93 for path in temporary_files:
94 if os.path.exists(path):
95 os.remove(path)
96 # We always clobber this to save disk on the arm board.
97 bot.Clobber(force=True)
98
99 def main():
100 name, is_buildbot = bot.GetBotName()
101
102 cross_vm_pattern_match = re.match(CROSS_VM, name)
103 target_vm_pattern_match = re.match(TARGET_VM, name)
104 if cross_vm_pattern_match:
105 arch = cross_vm_pattern_match.group(1)
106 mode = cross_vm_pattern_match.group(2)
107 cross_compiling_builder(arch, mode)
108 elif target_vm_pattern_match:
109 arch = target_vm_pattern_match.group(1)
110 mode = target_vm_pattern_match.group(5)
111 shard_index = target_vm_pattern_match.group(3)
112 total_shards = target_vm_pattern_match.group(4)
113 target_builder(arch, mode, total_shards, shard_index)
114 else:
115 raise Exception("Unknown builder name %s" % name)
116
117 if __name__ == '__main__':
118 try:
119 sys.exit(main())
120 except OSError as e:
121 sys.exit(e.errno)
OLDNEW
« no previous file with comments | « tools/bots/compiler.py ('k') | tools/bots/dartium_android.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698