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

Side by Side Diff: tools/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: Moved files. 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
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
21
22 def LoadConfigFile():
23 """Attempts to load the file 'run-bisect-perf-regression.cfg' as a module
24 and grab the global config dict.
25
26 Returns:
27 The config dict which should be formatted as follows:
28 {'command': string, 'good_revision': string, 'bad_revision': string
29 'metric': string}.
30 Returns None on failure.
31 """
32 try:
33 local_vars = {}
34 execfile('run-bisect-perf-regression.cfg', local_vars)
35
36 return local_vars['config']
37 except:
38 return None
39
40
41 def RunBisectionScript(config, working_directory):
42 """Attempts to execute src/tools/bisect-perf-regression.py with the parameters
43 passed in.
44
45 Args:
46 config: A dict containing the parameters to pass to the script.
47
48 Returns:
49 0 on success, otherwise 1.
50 """
51
52 cmd = ['python', 'bisect-perf-regression.py',
53 '-c', config['command'],
54 '-g', config['good_revision'],
55 '-b', config['bad_revision'],
56 '-m', config['metric'],
57 '--working_directory', working_directory,
58 '--output_buildbot_annotations']
59
60 return_code = subprocess.call(cmd)
61
62 if return_code:
63 print 'Error: bisect-perf-regression.py returned with error %d' %\
64 return_code
65 print
66 return 1
67
68 return 0
tonyg 2013/02/20 23:19:41 Why not just return return_code in all cases?
shatch 2013/02/20 23:32:05 Done.
69
70
71 def main():
72
73 usage = ('%prog [options] [-- chromium-options]\n'
74 'Used by a trybot to run the bisection script using the parameters'
75 ' provided in the run-bisect-perf-regression.cfg file.')
76
77 parser = optparse.OptionParser(usage=usage)
78 parser.add_option('-w', '--working_directory',
79 type='str',
80 help='A working directory to supply to the bisection '
81 'script, which will use it as the location to checkout '
82 'a copy of the chromium depot.')
83 (opts, args) = parser.parse_args()
84
85 if not opts.working_directory:
86 print 'Error: missing required parameter: --working_directory'
87 print
88 parser.print_help()
89 return 1
90
91 config = LoadConfigFile()
92 if not config:
93 print 'Error: Could not load config file.'
94 print
95 return 1
96
97 return RunBisectionScript(config, opts.working_directory)
98
99
100 if __name__ == '__main__':
101 sys.exit(main())
OLDNEW
« tools/bisect-perf-regression.py ('K') | « tools/run-bisect-perf-regression.cfg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698