Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: build/util/run-bisect-perf-regression.py

Issue 12261026: Added separate checkout and config file generation to bisect script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes from review. Created 7 years, 10 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
« no previous file with comments | « build/util/run-bisect-perf-regression.cfg ('k') | tools/bisect-perf-regression.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium 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 """Run Performance Test Bisect Tool
7
8 This script is used by a trybot to run the src/tools/bisect-perf-regression.py
9 script with the parameters specified in run-bisect-perf-regression.cfg. It will
10 check out a copy of the depot in a subdirectory 'bisect' of the working
11 directory provided, and run the bisect-perf-regression.py script there.
12
13 """
14
15 import imp
16 import optparse
17 import os
18 import subprocess
19 import sys
20
Mike Stip (use stip instead) 2013/02/20 01:04:44 extra line here
shatch 2013/02/20 19:34:09 Done.
21 def LoadConfigFile():
22 """Attempts to load the file 'run-bisect-perf-regression.cfg' as a module
23 and grab the global config dict.
24
25 Returns:
26 The config dict which should be formatted as follows:
27 {'command': string, 'good_revision': string, 'bad_revision': string
28 'metric': string}.
29 Returns None on failure.
30 """
31 try:
32 cfg_file = imp.load_source('config', 'run-bisect-perf-regression.cfg')
Mike Stip (use stip instead) 2013/02/20 01:04:44 I'm not sure if imp.load_source() is needed here.
33
34 return cfg_file.config
35 except (KeyError, TypeError, IOError):
36 return None
37
38
39 def RunBisectionScript(config, working_directory):
40 """Attempts to execute src/tools/bisect-perf-regression.py with the parameters
41 passed in.
42
43 Args:
44 config: A dict containing the parameters to pass to the script.
45
46 Returns:
47 0 on success, otherwise 1.
48 """
49
50 cmd = [os.path.join('..', '..', 'tools', 'bisect-perf-regression.py'),
51 '-c', config['command'],
52 '-g', config['good_revision'],
53 '-b', config['bad_revision'],
54 '-m', config['metric'],
55 '--working_directory', working_directory,
56 '--output_buildbot_annotations']
57
58 return_code = subprocess.call(cmd)
59
60 if return_code:
61 print 'Error: bisect-perf-regression.py returned with error %d' %\
62 return_code
63 print
64 return 1
65
66 return 0
67
68
69 def main():
70
71 usage = ('%prog [options] [-- chromium-options]\n'
72 'Used by a trybot to run the bisection script using the parameters'
73 ' provided in the run-bisect-perf-regression.cfg file.')
74
75 parser = optparse.OptionParser(usage=usage)
76 parser.add_option('-w', '--working_directory',
77 type='str',
78 help='A working directory to supply to the bisection '
79 'script, which will use it as the location to checkout '
80 'a copy of the chromium depot.')
81 (opts, args) = parser.parse_args()
82
83 if not opts.working_directory:
84 print 'Error: missing required parameter: --working_directory'
85 print
86 parser.print_help()
87 return 1
88
89 config = LoadConfigFile()
90 if not config:
91 print 'Error: Could not load config file.'
92 print
93 return 1
94
95 return RunBisectionScript(config, opts.working_directory)
96
97
98 if __name__ == '__main__':
99 sys.exit(main())
OLDNEW
« no previous file with comments | « build/util/run-bisect-perf-regression.cfg ('k') | tools/bisect-perf-regression.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698