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 16001005: Changed buildbot annotated steps to run tests on ARM device (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/test_options.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 shutil 8 import shutil
9 import sys 9 import sys
10 import tempfile
11 10
12 import bot 11 import bot
13 12
14 GCS_BUCKET = 'gs://dart-cross-compiled-binaries' 13 GCS_BUCKET = 'gs://dart-cross-compiled-binaries'
15 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 14 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
16 sys.path.append(os.path.join(SCRIPT_DIR, '..')) 15 sys.path.append(os.path.join(SCRIPT_DIR, '..'))
17 16
18 import utils 17 import utils
19 18
20 CROSS_VM = r'cross-(arm)-vm-linux-(release)' 19 CROSS_VM = r'cross-(arm)-vm-linux-(release)'
21 TARGET_VM = r'target-(arm)-vm-linux-(release)' 20 TARGET_VM = r'target-(arm)-vm-linux-(release)'
22 GSUTIL = utils.GetBuildbotGSUtilPath() 21 GSUTIL = utils.GetBuildbotGSUtilPath()
23 22
24 def run(args): 23 def run(args):
25 print 'Running: %s' % (' '.join(args)) 24 print 'Running: %s' % (' '.join(args))
26 sys.stdout.flush() 25 sys.stdout.flush()
27 bot.RunProcess(args) 26 bot.RunProcess(args)
28 27
28 def tarball_name(arch, mode):
29 return 'cross_build_%s_%s.tar.bz2' % (arch, mode)
30
31 def record_names(name, arch, mode):
32 return ('record_%s_%s_%s.json' % (name, arch, mode),
33 'record_output_%s_%s_%s.json' % (name, arch, mode))
34
35 def cross_compiling_builder(arch, mode):
36 build_py = os.path.join('tools', 'build.py')
37 test_py = os.path.join('tools', 'test.py')
38 test_args = [sys.executable, test_py, '--progress=line', '--report',
39 '--time', '--compiler=none', '--runtime=vm', '--write-debug-log']
40
41 tarball = tarball_name(arch, mode)
42 (recording, recording_out) = record_names('tests', arch, mode)
43 (checked_recording, checked_recording_out) = record_names(
44 'checked_tests', arch, mode)
45
46 temporary_files = [tarball, recording, recording_out, checked_recording,
47 checked_recording_out]
48 bot.Clobber()
49 try:
50 num_run = int(os.environ['BUILDBOT_ANNOTATED_STEPS_RUN'])
51 if num_run == 1:
52 # FIXME(kustermann/ricow): Remove this hack as soon as our bots are
53 # running on precise (i.e. then we can install the normal crosscompiler)
54 os.environ['TARGET_TOOLCHAIN_PREFIX'] = ('/home/chrome-bot/codesourcery'
55 '/bin/arm-none-linux-gnueabi')
56 with bot.BuildStep('Build %s %s' % (arch, mode)):
57 args = [sys.executable, build_py,
58 '-m%s' % mode, '--arch=%s' % arch, 'runtime']
59
60 run(args)
61 with bot.BuildStep('Create build tarball'):
62 run(['tar', '-cjf', tarball, '--exclude=**/obj',
63 '--exclude=**/obj.host', '--exclude=**/obj.target',
64 '--exclude=**/*analyzer*', '--exclude=**/*IA32', 'out/'])
65
66 with bot.BuildStep('Upload build tarball'):
67 uri = "%s/%s" % (GCS_BUCKET, tarball)
68 run([GSUTIL, 'cp', tarball, uri])
69 run([GSUTIL, 'setacl', 'public-read', uri])
70
71 with bot.BuildStep('prepare tests'):
72 uri = "%s/%s" % (GCS_BUCKET, recording)
73 run(test_args + ['--mode=' + mode, '--arch=' + arch,
74 '--record_to_file=' + recording])
75 run([GSUTIL, 'cp', recording, uri])
76 run([GSUTIL, 'setacl', 'public-read', uri])
77
78 with bot.BuildStep('prepare checked_tests'):
79 uri = "%s/%s" % (GCS_BUCKET, checked_recording)
80 run(test_args + ['--mode=' + mode, '--arch=' + arch, '--checked',
81 '--record_to_file=' + checked_recording])
82 run([GSUTIL, 'cp', checked_recording, uri])
83 run([GSUTIL, 'setacl', 'public-read', uri])
84 elif num_run == 2:
85 with bot.BuildStep('tests'):
86 uri = "%s/%s" % (GCS_BUCKET, recording)
87 run([GSUTIL, 'cp', uri, recording])
88 run(test_args + ['--mode=' + mode, '--arch=' + arch,
89 '--replay_from_file=' + recording_out])
90
91 with bot.BuildStep('checked_tests'):
92 uri = "%s/%s" % (GCS_BUCKET, checked_recording)
93 run([GSUTIL, 'cp', uri, checked_recording])
94 run(test_args + ['--mode=' + mode, '--arch=' + arch, '--checked',
95 '--replay_from_file=' + checked_recording_out])
96 else:
97 raise Exception("Invalid annotated steps run")
98 finally:
99 for path in temporary_files:
100 if os.path.exists(path):
101 os.remove(path)
102
103 def target_builder(arch, mode):
104 execute_testcases_py = os.path.join('tools', 'execute_recorded_testcases.py')
105
106 tarball = tarball_name(arch, mode)
107 (recording, recording_out) = record_names('tests', arch, mode)
108 (checked_recording, checked_recording_out) = record_names(
109 'checked_tests', arch, mode)
110
111 temporary_files = [tarball, recording, recording_out, checked_recording,
112 checked_recording_out]
113 bot.Clobber()
114 try:
115 with bot.BuildStep('Fetch build tarball'):
116 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball])
117
118 with bot.BuildStep('Unpack build tarball'):
119 run(['tar', '-xjf', tarball])
120
121 with bot.BuildStep('execute tests'):
122 uri = "%s/%s" % (GCS_BUCKET, recording)
123 uri_out = "%s/%s" % (GCS_BUCKET, recording_out)
124 run([GSUTIL, 'cp', uri, recording])
125 run(['python', execute_testcases_py, recording, recording_out])
126 run([GSUTIL, 'cp', recording_out, uri_out])
127 run([GSUTIL, 'setacl', 'public-read', uri_out])
128
129 with bot.BuildStep('execute checked_tests'):
130 uri = "%s/%s" % (GCS_BUCKET, checked_recording)
131 uri_out = "%s/%s" % (GCS_BUCKET, checked_recording_out)
132 run([GSUTIL, 'cp', uri, checked_recording])
133 run(['python', execute_testcases_py, checked_recording,
134 checked_recording_out])
135 run([GSUTIL, 'cp', recording_out, uri_out])
136 run([GSUTIL, 'setacl', 'public-read', uri_out])
137 finally:
138 for path in temporary_files:
139 if os.path.exists(path):
140 os.remove(path)
141
29 def main(): 142 def main():
30 name, is_buildbot = bot.GetBotName() 143 name, is_buildbot = bot.GetBotName()
31 build_py = os.path.join('tools', 'build.py')
32 test_py = os.path.join('tools', 'test.py')
33 144
34 cross_vm_pattern_match = re.match(CROSS_VM, name) 145 cross_vm_pattern_match = re.match(CROSS_VM, name)
35 target_vm_pattern_match = re.match(TARGET_VM, name) 146 target_vm_pattern_match = re.match(TARGET_VM, name)
36 if cross_vm_pattern_match: 147 if cross_vm_pattern_match:
37 arch = cross_vm_pattern_match.group(1) 148 arch = cross_vm_pattern_match.group(1)
38 mode = cross_vm_pattern_match.group(2) 149 mode = cross_vm_pattern_match.group(2)
39 150 cross_compiling_builder(arch, mode)
40 bot.Clobber()
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(['tar', '-cjf', tarball, '--exclude=**/obj',
50 '--exclude=**/obj.host', '--exclude=**/obj.target',
51 '--exclude=**/*analyzer*', 'out/'])
52
53 with bot.BuildStep('Upload build tarball'):
54 uri = "%s/%s" % (GCS_BUCKET, tarball)
55 run([GSUTIL, 'cp', tarball, uri])
56 run([GSUTIL, 'setacl', 'public-read', uri])
57 finally:
58 if os.path.exists(tarball):
59 os.remove(tarball)
60 elif target_vm_pattern_match: 151 elif target_vm_pattern_match:
61 arch = target_vm_pattern_match.group(1) 152 arch = target_vm_pattern_match.group(1)
62 mode = target_vm_pattern_match.group(2) 153 mode = target_vm_pattern_match.group(2)
63 154 target_builder(arch, mode)
64 bot.Clobber()
65 tarball = 'cross_build_%s_%s.tar.bz2' % (arch, mode)
66 try:
67 test_args = [sys.executable, test_py, '--progress=line', '--report',
68 '--time', '--mode=' + mode, '--arch=' + arch, '--compiler=none',
69 '--runtime=vm', '--write-debug-log']
70
71 with bot.BuildStep('Fetch build tarball'):
72 run([GSUTIL, 'cp', "%s/%s" % (GCS_BUCKET, tarball), tarball])
73
74 with bot.BuildStep('Unpack build tarball'):
75 run(['tar', '-xjf', tarball])
76
77 with bot.BuildStep('tests'):
78 run(test_args)
79
80 with bot.BuildStep('checked_tests'):
81 run(test_args + ['--checked'])
82 finally:
83 if os.path.exists(tarball):
84 os.remove(tarball)
85 else: 155 else:
86 raise Exception("Unknown builder name %s" % name) 156 raise Exception("Unknown builder name %s" % name)
87 157
88 if __name__ == '__main__': 158 if __name__ == '__main__':
89 sys.exit(main()) 159 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698