OLD | NEW |
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 |
| 15 import imp |
14 import optparse | 16 import optparse |
15 import os | 17 import os |
16 import platform | 18 import platform |
17 import subprocess | 19 import subprocess |
18 import sys | 20 import sys |
19 import traceback | 21 import traceback |
20 | 22 |
21 from auto_bisect import bisect_utils | 23 from auto_bisect import bisect_utils |
22 | 24 |
23 # Special import required because of dashes in file name. | 25 bisect = imp.load_source('bisect-perf-regression', |
24 bisect = __import__('bisect-perf-regression') | 26 os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), |
| 27 'bisect-perf-regression.py')) |
| 28 |
25 | 29 |
26 CROS_BOARD_ENV = 'BISECT_CROS_BOARD' | 30 CROS_BOARD_ENV = 'BISECT_CROS_BOARD' |
27 CROS_IP_ENV = 'BISECT_CROS_IP' | 31 CROS_IP_ENV = 'BISECT_CROS_IP' |
28 | 32 |
29 # Default config file names. | 33 # Default config file names. |
30 BISECT_REGRESSION_CONFIG = 'run-bisect-perf-regression.cfg' | 34 BISECT_REGRESSION_CONFIG = 'run-bisect-perf-regression.cfg' |
31 RUN_TEST_CONFIG = 'run-perf-test.cfg' | 35 RUN_TEST_CONFIG = 'run-perf-test.cfg' |
32 WEBKIT_RUN_TEST_CONFIG = os.path.join( | 36 WEBKIT_RUN_TEST_CONFIG = os.path.join( |
33 '..', 'third_party', 'WebKit', 'Tools', 'run-perf-test.cfg') | 37 '..', 'third_party', 'WebKit', 'Tools', 'run-perf-test.cfg') |
34 | 38 |
35 class Goma(object): | 39 class Goma(object): |
36 """Convenience class to start and stop goma.""" | |
37 | 40 |
38 def __init__(self, path_to_goma): | 41 def __init__(self, path_to_goma): |
39 self._abs_path_to_goma = None | 42 self._abs_path_to_goma = None |
40 self._abs_path_to_goma_file = None | 43 self._abs_path_to_goma_file = None |
41 if not path_to_goma: | 44 if not path_to_goma: |
42 return | 45 return |
43 self._abs_path_to_goma = os.path.abspath(path_to_goma) | 46 self._abs_path_to_goma = os.path.abspath(path_to_goma) |
44 filename = 'goma_ctl.bat' if os.name == 'nt' else 'goma_ctl.sh' | 47 filename = 'goma_ctl.bat' if os.name == 'nt' else 'goma_ctl.sh' |
45 self._abs_path_to_goma_file = os.path.join(self._abs_path_to_goma, filename) | 48 self._abs_path_to_goma_file = os.path.join(self._abs_path_to_goma, filename) |
46 | 49 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 self._Stop() | 85 self._Stop() |
83 | 86 |
84 if subprocess.call([self._abs_path_to_goma_file, 'start']): | 87 if subprocess.call([self._abs_path_to_goma_file, 'start']): |
85 raise RuntimeError('Goma failed to start.') | 88 raise RuntimeError('Goma failed to start.') |
86 | 89 |
87 def _Stop(self): | 90 def _Stop(self): |
88 subprocess.call([self._abs_path_to_goma_file, 'stop']) | 91 subprocess.call([self._abs_path_to_goma_file, 'stop']) |
89 | 92 |
90 | 93 |
91 def _LoadConfigFile(config_file_path): | 94 def _LoadConfigFile(config_file_path): |
92 """Loads to given file as a python module and returns the config dictionary. | 95 """Loads the given file as a python module and returns the config dictionary. |
93 | 96 |
94 The config file is loaded as a Python module. | 97 The config file is loaded as a Python module. |
95 | 98 |
96 Args: | 99 Args: |
97 config_file_path: Path to the config file. | 100 config_file_path: Path to the config file. |
98 | 101 |
99 Returns: | 102 Returns: |
100 If successful, returns the config dict loaded from the file. If no | 103 If successful, returns the config dict loaded from the file. If no |
101 such dictionary could be loaded, returns the empty dictionary. | 104 such dictionary could be loaded, returns the empty dictionary. |
102 """ | 105 """ |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 config, current_dir, opts.path_to_goma) | 551 config, current_dir, opts.path_to_goma) |
549 | 552 |
550 print ('Error: Could not load config file. Double check your changes to ' | 553 print ('Error: Could not load config file. Double check your changes to ' |
551 'run-bisect-perf-regression.cfg or run-perf-test.cfg for syntax ' | 554 'run-bisect-perf-regression.cfg or run-perf-test.cfg for syntax ' |
552 'errors.\n') | 555 'errors.\n') |
553 return 1 | 556 return 1 |
554 | 557 |
555 | 558 |
556 if __name__ == '__main__': | 559 if __name__ == '__main__': |
557 sys.exit(main()) | 560 sys.exit(main()) |
OLD | NEW |