- add third_party src.
[platform/framework/web/crosswalk.git] / src / native_client / buildbot / buildbot_selector.py
1 #!/usr/bin/python
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7 import subprocess
8 import sys
9
10 python = sys.executable
11
12
13 BOT_ASSIGNMENT = {
14     ######################################################################
15     # Buildbots.
16     ######################################################################
17     'xp-newlib-opt':
18         python + ' buildbot\\buildbot_standard.py opt 32 newlib --no-gyp',
19     'xp-glibc-opt':
20         python + ' buildbot\\buildbot_standard.py opt 32 glibc --no-gyp',
21
22     'xp-bare-newlib-opt':
23         python + ' buildbot\\buildbot_standard.py opt 32 newlib --no-gyp',
24     'xp-bare-glibc-opt':
25         python + ' buildbot\\buildbot_standard.py opt 32 glibc --no-gyp',
26
27     'lucid-64-validator-opt':
28         python + ' buildbot/buildbot_standard.py opt 64 glibc --validator',
29     'precise-64-validator-opt':
30         python + ' buildbot/buildbot_standard.py opt 64 glibc --validator',
31
32     # Clang.
33     'lucid_64-newlib-dbg-clang':
34         'echo "TODO(mcgrathr): linux clang disabled pending bot upgrades"',
35       #python + ' buildbot/buildbot_standard.py dbg 64 newlib --clang',
36     'precise_64-newlib-dbg-clang':
37       python + ' buildbot/buildbot_standard.py dbg 64 newlib --clang',
38     'mac10.7-newlib-dbg-clang':
39       python + ' buildbot/buildbot_standard.py dbg 32 newlib --clang',
40
41     # ASan.
42     'lucid_64-newlib-dbg-asan':
43         'echo "TODO(mcgrathr): linux asan disabled pending bot upgrades"',
44       #python + ' buildbot/buildbot_standard.py opt 64 newlib --asan',
45     'precise_64-newlib-dbg-asan':
46       python + ' buildbot/buildbot_standard.py opt 64 newlib --asan',
47     'mac10.7-newlib-dbg-asan':
48       python + ' buildbot/buildbot_standard.py opt 32 newlib --asan',
49
50     # PNaCl.
51     'lucid_64-newlib-arm_qemu-pnacl-dbg':
52         'bash buildbot/buildbot_pnacl.sh mode-buildbot-arm-dbg',
53     'lucid_64-newlib-arm_qemu-pnacl-opt':
54         'bash buildbot/buildbot_pnacl.sh mode-buildbot-arm-opt',
55     'oneiric_32-newlib-arm_hw-pnacl-panda-dbg':
56         'bash buildbot/buildbot_pnacl.sh mode-buildbot-arm-hw-dbg',
57     'oneiric_32-newlib-arm_hw-pnacl-panda-opt':
58         'bash buildbot/buildbot_pnacl.sh mode-buildbot-arm-hw-opt',
59     'lucid_64-newlib-x86_32-pnacl':
60         'bash buildbot/buildbot_pnacl.sh mode-buildbot-x86 32',
61     'lucid_64-newlib-x86_64-pnacl':
62         'bash buildbot/buildbot_pnacl.sh mode-buildbot-x86 64',
63     'lucid_64-newlib-mips-pnacl':
64         'echo "TODO(mseaborn): add mips"',
65     'precise_64-newlib-arm_qemu-pnacl-dbg':
66         'bash buildbot/buildbot_pnacl.sh mode-buildbot-arm-dbg',
67     'precise_64-newlib-arm_qemu-pnacl-opt':
68         'bash buildbot/buildbot_pnacl.sh mode-buildbot-arm-opt',
69     'precise_64-newlib-x86_32-pnacl':
70         'bash buildbot/buildbot_pnacl.sh mode-buildbot-x86 32',
71     'precise_64-newlib-x86_64-pnacl':
72         'bash buildbot/buildbot_pnacl.sh mode-buildbot-x86 64',
73     'precise_64-newlib-mips-pnacl':
74         'echo "TODO(mseaborn): add mips"',
75     # PNaCl Spec
76     'lucid_64-newlib-arm_qemu-pnacl-buildonly-spec':
77       'bash buildbot/buildbot_spec2k.sh pnacl-arm-buildonly',
78     'oneiric_32-newlib-arm_hw-pnacl-panda-spec':
79       'bash buildbot/buildbot_spec2k.sh pnacl-arm-hw',
80     'lucid_64-newlib-x86_32-pnacl-spec':
81       'bash buildbot/buildbot_spec2k.sh pnacl-x8632',
82     'lucid_64-newlib-x86_64-pnacl-spec':
83       'bash buildbot/buildbot_spec2k.sh pnacl-x8664',
84     'precise_64-newlib-arm_qemu-pnacl-buildonly-spec':
85       'bash buildbot/buildbot_spec2k.sh pnacl-arm-buildonly',
86     # NaCl Spec
87     'lucid_64-newlib-x86_32-spec':
88       'bash buildbot/buildbot_spec2k.sh nacl-x8632',
89     'lucid_64-newlib-x86_64-spec':
90       'bash buildbot/buildbot_spec2k.sh nacl-x8664',
91
92     # Valgrind bots.
93     'lucid-64-newlib-dbg-valgrind': 'bash buildbot/buildbot_valgrind.sh newlib',
94     'lucid-64-glibc-dbg-valgrind': 'bash buildbot/buildbot_valgrind.sh glibc',
95     'precise-64-newlib-dbg-valgrind':
96         'bash buildbot/buildbot_valgrind.sh newlib',
97     'precise-64-glibc-dbg-valgrind':
98         'bash buildbot/buildbot_valgrind.sh glibc',
99     # Coverage.
100     'mac10.6-newlib-coverage':
101          python + (' buildbot/buildbot_standard.py '
102                    'coverage 64 newlib --coverage --clang'),
103     'lucid-64-32-newlib-coverage':
104          python + (' buildbot/buildbot_standard.py '
105                    'coverage 32 newlib --coverage'),
106     'lucid-64-64-newlib-coverage':
107          python + (' buildbot/buildbot_standard.py '
108                    'coverage 64 newlib --coverage'),
109     'precise-64-32-newlib-coverage':
110          python + (' buildbot/buildbot_standard.py '
111                    'coverage 32 newlib --coverage'),
112     'precise-64-64-newlib-coverage':
113          python + (' buildbot/buildbot_standard.py '
114                    'coverage 64 newlib --coverage'),
115     'xp-newlib-coverage':
116          python + (' buildbot/buildbot_standard.py '
117                    'coverage 32 newlib --coverage'),
118     # PPAPI Integration.
119     'lucid64-m32-n32-opt-ppapi':
120         python + ' buildbot/buildbot_standard.py opt 32 newlib',
121     'lucid64-m64-n64-dbg-ppapi':
122         python + ' buildbot/buildbot_standard.py dbg 64 newlib',
123
124     ######################################################################
125     # Trybots.
126     ######################################################################
127     'nacl-precise64_validator_opt':
128         python + ' buildbot/buildbot_standard.py opt 64 glibc --validator',
129     'nacl-precise64_newlib_dbg_valgrind':
130         'bash buildbot/buildbot_valgrind.sh newlib',
131     'nacl-precise64_glibc_dbg_valgrind':
132         'bash buildbot/buildbot_valgrind.sh glibc',
133     # Coverage trybots.
134     'nacl-mac10.6-newlib-coverage':
135          python + (' buildbot/buildbot_standard.py '
136                    'coverage 64 newlib --coverage --clang'),
137     'nacl-precise-64-32-newlib-coverage':
138          python + (' buildbot/buildbot_standard.py '
139                    'coverage 32 newlib --coverage'),
140     'nacl-precise-64-64-newlib-coverage':
141          python + (' buildbot/buildbot_standard.py '
142                    'coverage 64 newlib --coverage'),
143     'nacl-win32-newlib-coverage':
144          python + (' buildbot/buildbot_standard.py '
145                    'coverage 32 newlib --coverage'),
146     # Clang trybots.
147     'nacl-precise_64-newlib-dbg-clang':
148         #python + ' buildbot/buildbot_standard.py dbg 64 newlib --clang',
149         'echo "TODO(mcgrathr): linux clang disabled pending bot upgrades"',
150     'nacl-mac10.6-newlib-dbg-clang':
151         python + ' buildbot/buildbot_standard.py dbg 32 newlib --clang',
152     # Pnacl main trybots
153     'nacl-precise_64-newlib-arm_qemu-pnacl':
154         'bash buildbot/buildbot_pnacl.sh mode-trybot-qemu',
155     'nacl-precise_64-newlib-x86_32-pnacl':
156         'bash buildbot/buildbot_pnacl.sh mode-buildbot-x86 32',
157     'nacl-precise_64-newlib-x86_64-pnacl':
158         'bash buildbot/buildbot_pnacl.sh mode-buildbot-x86 64',
159     'nacl-precise_64-newlib-mips-pnacl':
160         'echo "TODO(mseaborn): add mips"',
161     'nacl-precise_64-newlib-x86_64-pnacl':
162         'bash buildbot/buildbot_pnacl.sh mode-buildbot-x86 64',
163     'nacl-arm_opt_panda':
164         'bash buildbot/buildbot_pnacl.sh mode-buildbot-arm-try',
165     'nacl-arm_hw_opt_panda':
166         'bash buildbot/buildbot_pnacl.sh mode-buildbot-arm-hw-try',
167     # Pnacl spec2k trybots
168     'nacl-precise_64-newlib-x86_32-pnacl-spec':
169         'bash buildbot/buildbot_spec2k.sh pnacl-trybot-x8632',
170     'nacl-precise_64-newlib-x86_64-pnacl-spec':
171         'bash buildbot/buildbot_spec2k.sh pnacl-trybot-x8664',
172     'nacl-arm_perf_panda':
173         'bash buildbot/buildbot_spec2k.sh pnacl-trybot-arm-buildonly',
174     'nacl-arm_hw_perf_panda':
175         'bash buildbot/buildbot_spec2k.sh pnacl-trybot-arm-hw',
176     # Toolchain glibc.
177     'lucid64-glibc': 'bash buildbot/buildbot_linux-glibc-makefile.sh',
178     'precise64-glibc': 'bash buildbot/buildbot_linux-glibc-makefile.sh',
179     'mac-glibc': 'bash buildbot/buildbot_mac-glibc-makefile.sh',
180     'win7-glibc': 'buildbot\\buildbot_windows-glibc-makefile.bat',
181     # Toolchain newlib x86.
182     'win7-toolchain_x86': 'buildbot\\buildbot_toolchain_win.bat',
183     'mac-toolchain_x86': 'bash buildbot/buildbot_toolchain.sh mac',
184     'lucid64-toolchain_x86': 'bash buildbot/buildbot_toolchain.sh linux',
185     'precise64-toolchain_x86': 'bash buildbot/buildbot_toolchain.sh linux',
186     # Toolchain newlib arm.
187     'win7-toolchain_arm':
188         python + ' buildbot/buildbot_toolchain_build.py --buildbot',
189     'mac-toolchain_arm':
190         python + ' buildbot/buildbot_toolchain_build.py --buildbot',
191     'precise64-toolchain_arm':
192         python + ' buildbot/buildbot_toolchain_build.py --buildbot',
193     'lucid64-toolchain_arm':
194         python + ' buildbot/buildbot_toolchain_build.py --buildbot',
195
196     # Pnacl toolchain builders (second argument indicates trybot).
197     'linux-armtools-x86_32':
198         'bash buildbot/buildbot_toolchain_arm_trusted.sh',
199     'linux-pnacl-x86_32':
200         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8632-linux false',
201     'linux-pnacl-x86_64':
202         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8664-linux false',
203     'precise-pnacl-x86_32':
204         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8632-linux false',
205     'precise-pnacl-x86_64':
206         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8664-linux false',
207     'mac-pnacl-x86_32':
208         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8632-mac false',
209     # TODO(robertm): Delete this once we are using win-pnacl-x86_64
210     'win-pnacl-x86_32':
211         'buildbot\\buildbot_pnacl.bat mode-buildbot-tc-x8664-win false',
212     # TODO(robertm): use this in favor or the misnamed win-pnacl-x86_32
213     'win-pnacl-x86_64':
214         'buildbot\\buildbot_pnacl.bat mode-buildbot-tc-x8664-win false',
215
216     # Pnacl toolchain testers
217     'linux-pnacl-x86_64-tests-x86_64':
218         'bash buildbot/buildbot_pnacl_toolchain_tests.sh tc-test-bot x86-64',
219     'linux-pnacl-x86_64-tests-x86_32':
220         'bash buildbot/buildbot_pnacl_toolchain_tests.sh tc-test-bot x86-32',
221     'linux-pnacl-x86_64-tests-arm':
222         'bash buildbot/buildbot_pnacl_toolchain_tests.sh tc-test-bot arm',
223
224     # MIPS toolchain buildbot.
225     'linux-pnacl-x86_32-tests-mips':
226         'bash tools/trusted_cross_toolchains/'
227         'trusted-toolchain-creator.mipsel.debian.sh nacl_sdk',
228
229     # Toolchain trybots.
230     'nacl-toolchain-precise64-newlib':
231         'bash buildbot/buildbot_toolchain.sh linux',
232     'nacl-toolchain-mac-newlib': 'bash buildbot/buildbot_toolchain.sh mac',
233     'nacl-toolchain-win7-newlib': 'buildbot\\buildbot_toolchain_win.bat',
234     'nacl-toolchain-precise64-newlib-arm':
235         python + ' buildbot/buildbot_toolchain_build.py --trybot',
236     'nacl-toolchain-mac-newlib-arm':
237         python + ' buildbot/buildbot_toolchain_build.py --trybot',
238     'nacl-toolchain-win7-newlib-arm':
239         python + ' buildbot/buildbot_toolchain_build.py --trybot',
240     'nacl-toolchain-precise64-glibc':
241         'bash buildbot/buildbot_linux-glibc-makefile.sh',
242     'nacl-toolchain-mac-glibc': 'bash buildbot/buildbot_mac-glibc-makefile.sh',
243     'nacl-toolchain-win7-glibc':
244         'buildbot\\buildbot_windows-glibc-makefile.bat',
245
246     # Pnacl toolchain trybots (second argument indicates trybot).
247     'nacl-toolchain-linux-pnacl-x86_32':
248         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8632-linux true',
249     'nacl-toolchain-linux-pnacl-x86_64':
250         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8664-linux true',
251     'nacl-toolchain-linux-pnacl-mips': 'echo "TODO(mseaborn)"',
252     'nacl-toolchain-precise-pnacl-x86_32':
253         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8632-linux true',
254     'nacl-toolchain-precise-pnacl-x86_64':
255         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8664-linux true',
256     'nacl-toolchain-precise-pnacl-mips': 'echo "TODO(mseaborn)"',
257     'nacl-toolchain-mac-pnacl-x86_32':
258         'bash buildbot/buildbot_pnacl.sh mode-buildbot-tc-x8632-mac true',
259     'nacl-toolchain-win7-pnacl-x86_64':
260         'buildbot\\buildbot_pnacl.bat mode-buildbot-tc-x8664-win true',
261
262     # PNaCl LLVM Merging bots
263     'llvm':
264         'bash buildbot/buildbot_pnacl_merge.sh merge-bot',
265     'llvm-scons':
266         'bash buildbot/buildbot_pnacl_merge.sh scons-bot',
267     'llvm-spec2k-x86':
268         'bash buildbot/buildbot_pnacl_merge.sh spec2k-x86-bot',
269     'llvm-spec2k-arm':
270         'bash buildbot/buildbot_pnacl_merge.sh spec2k-arm-bot',
271
272 }
273
274 special_for_arm = [
275     'win7_64',
276     'win7-64',
277     'lucid-64',
278     'lucid64',
279     'precise-64',
280     'precise64'
281 ]
282 for platform in [
283     'vista', 'win7', 'win8', 'win',
284     'mac10.6', 'mac10.7', 'mac10.8',
285     'lucid', 'precise'] + special_for_arm:
286   if platform in special_for_arm:
287     arch_variants = ['arm']
288   else:
289     arch_variants = ['', '32', '64', 'arm']
290   for arch in arch_variants:
291     arch_flags = ''
292     real_arch = arch
293     arch_part = '-' + arch
294     # Disable GYP build for win32 bots and arm cross-builders. In this case
295     # "win" means Windows XP, not Vista, Windows 7, etc.
296     #
297     # Building via GYP always builds all toolchains by default, but the win32
298     # XP pnacl builds are pathologically slow (e.g. ~38 seconds per compile on
299     # the nacl-win32_glibc_opt trybot). There are other builders that test
300     # Windows builds via gyp, so the reduced test coverage should be slight.
301     if arch == 'arm' or (platform == 'win' and arch == '32'):
302       arch_flags += ' --no-gyp'
303     if arch == '':
304       arch_part = ''
305       real_arch = '32'
306     if platform.startswith('mac'):
307       arch_flags += ' --clang'
308     # Test with Breakpad tools only on basic Linux builds.
309     if sys.platform.startswith('linux'):
310       arch_flags += ' --use-breakpad-tools'
311     for mode in ['dbg', 'opt']:
312       for libc in ['newlib', 'glibc']:
313         # Buildbots.
314         for bare in ['', '-bare']:
315           name = platform + arch_part + bare + '-' + libc + '-' + mode
316           assert name not in BOT_ASSIGNMENT, name
317           BOT_ASSIGNMENT[name] = (
318               python + ' buildbot/buildbot_standard.py ' +
319               mode + ' ' + real_arch + ' ' + libc + arch_flags)
320         # Trybots
321         for arch_sep in ['', '-', '_']:
322           name = 'nacl-' + platform + arch_sep + arch + '_' + libc + '_' + mode
323           assert name not in BOT_ASSIGNMENT, name
324           BOT_ASSIGNMENT[name] = (
325               python + ' buildbot/buildbot_standard.py ' +
326               mode + ' ' + real_arch + ' ' + libc + arch_flags)
327
328
329 def Main():
330   builder = os.environ.get('BUILDBOT_BUILDERNAME')
331   cmd = BOT_ASSIGNMENT.get(builder)
332   if not cmd:
333     sys.stderr.write('ERROR - unset/invalid builder name\n')
334     sys.exit(1)
335
336   env = os.environ.copy()
337
338   # Use .boto file from home-dir instead of buildbot supplied one.
339   if 'AWS_CREDENTIAL_FILE' in env:
340     del env['AWS_CREDENTIAL_FILE']
341   if 'BOTO_CONFIG' in env:
342     del env['BOTO_CONFIG']
343
344   if sys.platform in ['win32', 'cygwin']:
345     env['GSUTIL'] = r'\b\build\scripts\slave\gsutil.bat'
346   else:
347     env['GSUTIL'] = '/b/build/scripts/slave/gsutil'
348
349   print "%s runs: %s\n" % (builder, cmd)
350   retcode = subprocess.call(cmd, env=env, shell=True)
351   sys.exit(retcode)
352
353
354 if __name__ == '__main__':
355   Main()