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

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

Issue 16007011: Display traceback after failing to load cfg. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 """Run Performance Test Bisect Tool 6 """Run Performance Test Bisect Tool
7 7
8 This script is used by a trybot to run the src/tools/bisect-perf-regression.py 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 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 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. 11 directory provided, and run the bisect-perf-regression.py script there.
12 12
13 """ 13 """
14 14
15 import imp 15 import imp
16 import optparse 16 import optparse
17 import os 17 import os
18 import subprocess 18 import subprocess
19 import sys 19 import sys
20 import traceback
20 21
21 22
22 def LoadConfigFile(path_to_file): 23 def LoadConfigFile(path_to_file):
23 """Attempts to load the file 'run-bisect-perf-regression.cfg' as a module 24 """Attempts to load the file 'run-bisect-perf-regression.cfg' as a module
24 and grab the global config dict. 25 and grab the global config dict.
25 26
26 Args: 27 Args:
27 path_to_file: Path to the run-bisect-perf-regression.cfg file. 28 path_to_file: Path to the run-bisect-perf-regression.cfg file.
28 29
29 Returns: 30 Returns:
30 The config dict which should be formatted as follows: 31 The config dict which should be formatted as follows:
31 {'command': string, 'good_revision': string, 'bad_revision': string 32 {'command': string, 'good_revision': string, 'bad_revision': string
32 'metric': string}. 33 'metric': string}.
33 Returns None on failure. 34 Returns None on failure.
34 """ 35 """
35 try: 36 try:
36 local_vars = {} 37 local_vars = {}
37 execfile(os.path.join(path_to_file, 'run-bisect-perf-regression.cfg'), 38 execfile(os.path.join(path_to_file, 'run-bisect-perf-regression.cfg'),
38 local_vars) 39 local_vars)
39 40
40 return local_vars['config'] 41 return local_vars['config']
41 except: 42 except:
43 print
44 traceback.print_exc()
45 print
42 return None 46 return None
43 47
44 48
45 def RunBisectionScript(config, working_directory, path_to_file, path_to_goma): 49 def RunBisectionScript(config, working_directory, path_to_file, path_to_goma):
46 """Attempts to execute src/tools/bisect-perf-regression.py with the parameters 50 """Attempts to execute src/tools/bisect-perf-regression.py with the parameters
47 passed in. 51 passed in.
48 52
49 Args: 53 Args:
50 config: A dict containing the parameters to pass to the script. 54 config: A dict containing the parameters to pass to the script.
51 working_directory: A working directory to provide to the 55 working_directory: A working directory to provide to the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if not opts.working_directory: 145 if not opts.working_directory:
142 print 'Error: missing required parameter: --working_directory' 146 print 'Error: missing required parameter: --working_directory'
143 print 147 print
144 parser.print_help() 148 parser.print_help()
145 return 1 149 return 1
146 150
147 path_to_file = os.path.abspath(os.path.dirname(sys.argv[0])) 151 path_to_file = os.path.abspath(os.path.dirname(sys.argv[0]))
148 152
149 config = LoadConfigFile(path_to_file) 153 config = LoadConfigFile(path_to_file)
150 if not config: 154 if not config:
151 print 'Error: Could not load config file.' 155 print 'Error: Could not load config file. Double check your changes to '\
156 'run-bisect-perf-regression.cfg for syntax errors.'
152 print 157 print
153 return 1 158 return 1
154 159
155 return RunBisectionScript(config, opts.working_directory, path_to_file, 160 return RunBisectionScript(config, opts.working_directory, path_to_file,
156 opts.path_to_goma) 161 opts.path_to_goma)
157 162
158 163
159 if __name__ == '__main__': 164 if __name__ == '__main__':
160 sys.exit(main()) 165 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698