OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
| 6 import argparse |
6 import find_depot_tools | 7 import find_depot_tools |
7 import sys | 8 import sys |
8 | 9 |
9 find_depot_tools.add_depot_tools_to_path() | 10 find_depot_tools.add_depot_tools_to_path() |
10 | 11 |
11 from git_cl import Changelist | 12 from git_cl import Changelist |
12 | 13 |
13 BOTS = [ | 14 BOTS = { |
| 15 '--linux32': 'v8_linux32_perf_try', |
| 16 '--linux64': 'v8_linux64_perf_try', |
| 17 '--linux64_haswell': 'v8_linux64_haswell_perf_try', |
| 18 } |
| 19 |
| 20 DEFAULT_BOTS = [ |
14 'v8_linux32_perf_try', | 21 'v8_linux32_perf_try', |
15 'v8_linux64_perf_try', | 22 'v8_linux64_haswell_perf_try', |
16 ] | 23 ] |
17 | 24 |
18 def main(tests): | 25 def main(): |
| 26 parser = argparse.ArgumentParser(description='') |
| 27 parser.add_argument("benchmarks", nargs="+", help="The benchmarks to run.") |
| 28 for option in sorted(BOTS): |
| 29 parser.add_argument( |
| 30 option, dest='bots', action='append_const', const=BOTS[option], |
| 31 help='Add %s trybot.' % BOTS[option]) |
| 32 options = parser.parse_args() |
| 33 if not options.bots: |
| 34 print 'No trybots specified. Using default %s.' % ','.join(DEFAULT_BOTS) |
| 35 options.bots = DEFAULT_BOTS |
| 36 |
19 cl = Changelist() | 37 cl = Changelist() |
20 if not cl.GetIssue(): | 38 if not cl.GetIssue(): |
21 print 'Need to upload first' | 39 print 'Need to upload first' |
22 return 1 | 40 return 1 |
23 | 41 |
24 props = cl.GetIssueProperties() | 42 props = cl.GetIssueProperties() |
25 if props.get('closed'): | 43 if props.get('closed'): |
26 print 'Cannot send tryjobs for a closed CL' | 44 print 'Cannot send tryjobs for a closed CL' |
27 return 1 | 45 return 1 |
28 | 46 |
29 if props.get('private'): | 47 if props.get('private'): |
30 print 'Cannot use trybots with private issue' | 48 print 'Cannot use trybots with private issue' |
31 return 1 | 49 return 1 |
32 | 50 |
33 if not tests: | 51 if not options.benchmarks: |
34 print 'Please specify the benchmarks to run as arguments.' | 52 print 'Please specify the benchmarks to run as arguments.' |
35 return 1 | 53 return 1 |
36 | 54 |
37 masters = {'internal.client.v8': dict((b, tests) for b in BOTS)} | 55 masters = { |
| 56 'internal.client.v8': dict((b, options.benchmarks) for b in options.bots), |
| 57 } |
38 cl.RpcServer().trigger_distributed_try_jobs( | 58 cl.RpcServer().trigger_distributed_try_jobs( |
39 cl.GetIssue(), cl.GetMostRecentPatchset(), cl.GetBranch(), | 59 cl.GetIssue(), cl.GetMostRecentPatchset(), cl.GetBranch(), |
40 False, None, masters) | 60 False, None, masters) |
41 return 0 | 61 return 0 |
42 | 62 |
43 if __name__ == "__main__": # pragma: no cover | 63 if __name__ == "__main__": # pragma: no cover |
44 sys.exit(main(sys.argv[1:])) | 64 sys.exit(main()) |
OLD | NEW |