blob: 5565b80826b11a52de077ed05881196b3777ae33 [file] [log] [blame]
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001#!/usr/bin/env python
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
4# found in the LICENSE file.
5
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00006import argparse
7import os
8import subprocess
Emily Bernierd0a1eb72015-03-24 16:35:39 -04009import sys
10
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000011BOTS = {
12 '--arm32': 'v8_arm32_perf_try',
13 '--linux32': 'v8_linux32_perf_try',
14 '--linux64': 'v8_linux64_perf_try',
15 '--linux64_atom': 'v8_linux64_atom_perf_try',
16 '--linux64_haswell': 'v8_linux64_haswell_perf_try',
17 '--nexus5': 'v8_nexus5_perf_try',
18 '--nexus7': 'v8_nexus7_perf_try',
19 '--nexus9': 'v8_nexus9_perf_try',
20 '--nexus10': 'v8_nexus10_perf_try',
21}
Emily Bernierd0a1eb72015-03-24 16:35:39 -040022
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000023DEFAULT_BOTS = [
24 'v8_arm32_perf_try',
Emily Bernierd0a1eb72015-03-24 16:35:39 -040025 'v8_linux32_perf_try',
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000026 'v8_linux64_haswell_perf_try',
27 'v8_nexus10_perf_try',
Emily Bernierd0a1eb72015-03-24 16:35:39 -040028]
29
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000030PUBLIC_BENCHMARKS = [
31 'arewefastyet',
32 'embenchen',
33 'emscripten',
34 'compile',
35 'jetstream',
36 'jsbench',
37 'jstests',
38 'kraken_orig',
39 'massive',
40 'memory',
41 'octane',
42 'octane-pr',
43 'octane-tf',
44 'octane-tf-pr',
45 'simdjs',
46 'sunspider',
Ben Murdochc5610432016-08-08 18:44:38 +010047 'wasm',
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000048]
Emily Bernierd0a1eb72015-03-24 16:35:39 -040049
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000050V8_BASE = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
Emily Bernierd0a1eb72015-03-24 16:35:39 -040051
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000052def main():
53 parser = argparse.ArgumentParser(description='')
54 parser.add_argument('benchmarks', nargs='+', help='The benchmarks to run.')
55 parser.add_argument('--extra-flags', default='',
56 help='Extra flags to be passed to the executable.')
Ben Murdoch097c5b22016-05-18 11:27:45 +010057 parser.add_argument('-r', '--revision', type=str, default=None,
58 help='Revision (use full hash!) to use for the try job; '
59 'default: the revision will be determined by the '
60 'try server; see its waterfall for more info')
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000061 for option in sorted(BOTS):
62 parser.add_argument(
63 option, dest='bots', action='append_const', const=BOTS[option],
64 help='Add %s trybot.' % BOTS[option])
65 options = parser.parse_args()
66 if not options.bots:
67 print 'No trybots specified. Using default %s.' % ','.join(DEFAULT_BOTS)
68 options.bots = DEFAULT_BOTS
Emily Bernierd0a1eb72015-03-24 16:35:39 -040069
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000070 if not options.benchmarks:
Emily Bernierd0a1eb72015-03-24 16:35:39 -040071 print 'Please specify the benchmarks to run as arguments.'
72 return 1
73
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000074 for benchmark in options.benchmarks:
75 if benchmark not in PUBLIC_BENCHMARKS:
76 print ('%s not found in our benchmark list. The respective trybot might '
77 'fail, unless you run something this script isn\'t aware of. '
78 'Available public benchmarks: %s' % (benchmark, PUBLIC_BENCHMARKS))
79 print 'Proceed anyways? [Y/n] ',
80 answer = sys.stdin.readline().strip()
81 if answer != "" and answer != "Y" and answer != "y":
82 return 1
Emily Bernierd0a1eb72015-03-24 16:35:39 -040083
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000084 assert '"' not in options.extra_flags and '\'' not in options.extra_flags, (
85 'Invalid flag specification.')
86
87 # Ensure depot_tools are updated.
88 subprocess.check_output(
89 'gclient', shell=True, stderr=subprocess.STDOUT, cwd=V8_BASE)
90
91 cmd = ['git cl try -m internal.client.v8']
92 cmd += ['-b %s' % bot for bot in options.bots]
Ben Murdoch097c5b22016-05-18 11:27:45 +010093 if options.revision: cmd += ['-r %s' % options.revision]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000094 benchmarks = ['"%s"' % benchmark for benchmark in options.benchmarks]
95 cmd += ['-p \'testfilter=[%s]\'' % ','.join(benchmarks)]
96 if options.extra_flags:
97 cmd += ['-p \'extra_flags="%s"\'' % options.extra_flags]
98 subprocess.check_call(' '.join(cmd), shell=True, cwd=V8_BASE)
99
100
101if __name__ == '__main__': # pragma: no cover
102 sys.exit(main())