• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/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
6import argparse
7import os
8import subprocess
9import sys
10
11BOTS = {
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}
22
23DEFAULT_BOTS = [
24  'v8_arm32_perf_try',
25  'v8_linux32_perf_try',
26  'v8_linux64_haswell_perf_try',
27  'v8_nexus10_perf_try',
28]
29
30PUBLIC_BENCHMARKS = [
31  'arewefastyet',
32  'embenchen',
33  'emscripten',
34  'compile',
35  'jetstream',
36  'jetstream-ignition',
37  'jsbench',
38  'jstests',
39  'kraken_orig',
40  'kraken_orig-ignition',
41  'massive',
42  'memory',
43  'octane',
44  'octane-noopt',
45  'octane-ignition',
46  'octane-pr',
47  'octane-tf',
48  'octane-tf-pr',
49  'sunspider',
50  'sunspider-ignition',
51  'unity',
52  'wasm',
53]
54
55V8_BASE = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
56
57def main():
58  parser = argparse.ArgumentParser(description='')
59  parser.add_argument('benchmarks', nargs='+', help='The benchmarks to run.')
60  parser.add_argument('--extra-flags', default='',
61                      help='Extra flags to be passed to the executable.')
62  parser.add_argument('-r', '--revision', type=str, default=None,
63                      help='Revision (use full hash!) to use for the try job; '
64                           'default: the revision will be determined by the '
65                           'try server; see its waterfall for more info')
66  for option in sorted(BOTS):
67    parser.add_argument(
68        option, dest='bots', action='append_const', const=BOTS[option],
69        help='Add %s trybot.' % BOTS[option])
70  options = parser.parse_args()
71  if not options.bots:
72    print 'No trybots specified. Using default %s.' % ','.join(DEFAULT_BOTS)
73    options.bots = DEFAULT_BOTS
74
75  if not options.benchmarks:
76    print 'Please specify the benchmarks to run as arguments.'
77    return 1
78
79  for benchmark in options.benchmarks:
80    if benchmark not in PUBLIC_BENCHMARKS:
81      print ('%s not found in our benchmark list. The respective trybot might '
82            'fail, unless you run something this script isn\'t aware of. '
83            'Available public benchmarks: %s' % (benchmark, PUBLIC_BENCHMARKS))
84      print 'Proceed anyways? [Y/n] ',
85      answer = sys.stdin.readline().strip()
86      if answer != "" and answer != "Y" and answer != "y":
87        return 1
88
89  assert '"' not in options.extra_flags and '\'' not in options.extra_flags, (
90      'Invalid flag specification.')
91
92  # Ensure depot_tools are updated.
93  subprocess.check_output(
94      'gclient', shell=True, stderr=subprocess.STDOUT, cwd=V8_BASE)
95
96  cmd = ['git cl try -m internal.client.v8']
97  cmd += ['-b %s' % bot for bot in options.bots]
98  if options.revision: cmd += ['-r %s' % options.revision]
99  benchmarks = ['"%s"' % benchmark for benchmark in options.benchmarks]
100  cmd += ['-p \'testfilter=[%s]\'' % ','.join(benchmarks)]
101  if options.extra_flags:
102    cmd += ['-p \'extra_flags="%s"\'' % options.extra_flags]
103  subprocess.check_call(' '.join(cmd), shell=True, cwd=V8_BASE)
104
105
106if __name__ == '__main__':  # pragma: no cover
107  sys.exit(main())
108