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

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

Issue 564663002: Move bisect-perf-regression.py into auto_bisect directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Upload a config for doing a test run. Created 6 years, 3 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
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 try bot to run the src/tools/bisect-perf-regression.py 8 This script is used by a try bot to run the bisect script with the parameters
9 script with the parameters specified in src/tools/auto_bisect/bisect.cfg. 9 specified in the bisect config file. It checks out a copy of the depot in
10 It will check out a copy of the depot in a subdirectory 'bisect' of the working 10 a subdirectory 'bisect' of the working directory provided, annd runs the
11 directory provided, and run the bisect-perf-regression.py script there. 11 bisect scrip there.
12 """ 12 """
13 13
14 import imp
15 import optparse 14 import optparse
16 import os 15 import os
17 import platform 16 import platform
18 import subprocess 17 import subprocess
19 import sys 18 import sys
20 import traceback 19 import traceback
21 20
21 from auto_bisect import bisect_perf_regression
22 from auto_bisect import bisect_utils 22 from auto_bisect import bisect_utils
23 from auto_bisect import math_utils 23 from auto_bisect import math_utils
24 24
25 bisect = imp.load_source('bisect-perf-regression',
26 os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),
27 'bisect-perf-regression.py'))
28
29
30 CROS_BOARD_ENV = 'BISECT_CROS_BOARD' 25 CROS_BOARD_ENV = 'BISECT_CROS_BOARD'
31 CROS_IP_ENV = 'BISECT_CROS_IP' 26 CROS_IP_ENV = 'BISECT_CROS_IP'
32 27
33 # Default config file paths, relative to this script. 28 # Default config file paths, relative to this script.
34 BISECT_REGRESSION_CONFIG = os.path.join('auto_bisect', 'bisect.cfg') 29 BISECT_REGRESSION_CONFIG = os.path.join('auto_bisect', 'bisect.cfg')
35 RUN_TEST_CONFIG = 'run-perf-test.cfg' 30 RUN_TEST_CONFIG = 'run-perf-test.cfg'
36 WEBKIT_RUN_TEST_CONFIG = os.path.join( 31 WEBKIT_RUN_TEST_CONFIG = os.path.join(
37 '..', 'third_party', 'WebKit', 'Tools', 'run-perf-test.cfg') 32 '..', 'third_party', 'WebKit', 'Tools', 'run-perf-test.cfg')
38 33
39 34
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 raise RuntimeError('CrOS build selected, but BISECT_CROS_IP or' 218 raise RuntimeError('CrOS build selected, but BISECT_CROS_IP or'
224 'BISECT_CROS_BOARD undefined.') 219 'BISECT_CROS_BOARD undefined.')
225 elif 'android' in config['command']: 220 elif 'android' in config['command']:
226 if 'android-chrome-shell' in config['command']: 221 if 'android-chrome-shell' in config['command']:
227 opts_dict['target_platform'] = 'android' 222 opts_dict['target_platform'] = 'android'
228 elif 'android-chrome' in config['command']: 223 elif 'android-chrome' in config['command']:
229 opts_dict['target_platform'] = 'android-chrome' 224 opts_dict['target_platform'] = 'android-chrome'
230 else: 225 else:
231 opts_dict['target_platform'] = 'android' 226 opts_dict['target_platform'] = 'android'
232 227
233 return bisect.BisectOptions.FromDict(opts_dict) 228 return bisect_perf_regression.BisectOptions.FromDict(opts_dict)
234 229
235 230
236 def _RunPerformanceTest(config, path_to_file): 231 def _RunPerformanceTest(config, path_to_file):
237 """Runs a performance test with and without the current patch. 232 """Runs a performance test with and without the current patch.
238 233
239 Args: 234 Args:
240 config: Contents of the config file, a dictionary. 235 config: Contents of the config file, a dictionary.
241 path_to_file: Path to the bisect-perf-regression.py script. 236 path_to_file: Path to the bisect script (bisect_perf_regression.py).
242 237
243 Attempts to build and run the current revision with and without the 238 Attempts to build and run the current revision with and without the
244 current patch, with the parameters passed in. 239 current patch, with the parameters passed in.
245 """ 240 """
246 # Bisect script expects to be run from the src directory 241 # Bisect script expects to be run from the src directory
247 os.chdir(os.path.join(path_to_file, '..')) 242 os.chdir(os.path.join(path_to_file, os.path.pardir))
248 243
249 bisect_utils.OutputAnnotationStepStart('Building With Patch') 244 bisect_utils.OutputAnnotationStepStart('Building With Patch')
250 245
251 opts = _CreateBisectOptionsFromConfig(config) 246 opts = _CreateBisectOptionsFromConfig(config)
252 b = bisect.BisectPerformanceMetrics(None, opts) 247 b = bisect_perf_regression.BisectPerformanceMetrics(None, opts)
253 248
254 if bisect_utils.RunGClient(['runhooks']): 249 if bisect_utils.RunGClient(['runhooks']):
255 raise RuntimeError('Failed to run gclient runhooks') 250 raise RuntimeError('Failed to run gclient runhooks')
256 251
257 if not b.BuildCurrentRevision('chromium'): 252 if not b.BuildCurrentRevision('chromium'):
258 raise RuntimeError('Patched version failed to build.') 253 raise RuntimeError('Patched version failed to build.')
259 254
260 bisect_utils.OutputAnnotationStepClosed() 255 bisect_utils.OutputAnnotationStepClosed()
261 bisect_utils.OutputAnnotationStepStart('Running With Patch') 256 bisect_utils.OutputAnnotationStepStart('Running With Patch')
262 257
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 elif cloud_file_link: 333 elif cloud_file_link:
339 bisect_utils.OutputAnnotationStepLink('HTML Results', cloud_file_link) 334 bisect_utils.OutputAnnotationStepLink('HTML Results', cloud_file_link)
340 335
341 336
342 def _SetupAndRunPerformanceTest(config, path_to_file, path_to_goma): 337 def _SetupAndRunPerformanceTest(config, path_to_file, path_to_goma):
343 """Attempts to build and run the current revision with and without the 338 """Attempts to build and run the current revision with and without the
344 current patch, with the parameters passed in. 339 current patch, with the parameters passed in.
345 340
346 Args: 341 Args:
347 config: The config read from run-perf-test.cfg. 342 config: The config read from run-perf-test.cfg.
348 path_to_file: Path to the bisect-perf-regression.py script. 343 path_to_file: Path to the bisect script (bisect_perf_regression.py).
349 path_to_goma: Path to goma directory. 344 path_to_goma: Path to goma directory.
350 345
351 Returns: 346 Returns:
352 The exit code of bisect-perf-regression.py: 0 on success, otherwise 1. 347 An exit code: 0 on success, otherwise 1.
353 """ 348 """
354 try: 349 try:
355 with Goma(path_to_goma) as _: 350 with Goma(path_to_goma) as _:
356 config['use_goma'] = bool(path_to_goma) 351 config['use_goma'] = bool(path_to_goma)
357 if config['use_goma']: 352 if config['use_goma']:
358 config['goma_dir'] = os.path.abspath(path_to_goma) 353 config['goma_dir'] = os.path.abspath(path_to_goma)
359 _RunPerformanceTest(config, path_to_file) 354 _RunPerformanceTest(config, path_to_file)
360 return 0 355 return 0
361 except RuntimeError, e: 356 except RuntimeError, e:
362 bisect_utils.OutputAnnotationStepClosed() 357 bisect_utils.OutputAnnotationStepClosed()
363 _OutputFailedResults('Error: %s' % e.message) 358 _OutputFailedResults('Error: %s' % e.message)
364 return 1 359 return 1
365 360
366 361
367 def _RunBisectionScript( 362 def _RunBisectionScript(
368 config, working_directory, path_to_file, path_to_goma, path_to_extra_src, 363 config, working_directory, path_to_file, path_to_goma, path_to_extra_src,
369 dry_run): 364 dry_run):
370 """Attempts to execute bisect-perf-regression.py with the given parameters. 365 """Attempts to execute the bisect script with the given parameters.
371 366
372 Args: 367 Args:
373 config: A dict containing the parameters to pass to the script. 368 config: A dict containing the parameters to pass to the script.
374 working_directory: A working directory to provide to the 369 working_directory: A working directory to provide to the bisect script,
375 bisect-perf-regression.py script, where it will store it's own copy of 370 where it will store it's own copy of the depot.
376 the depot. 371 path_to_file: Path to the bisect script (bisect_perf_regression.py).
377 path_to_file: Path to the bisect-perf-regression.py script.
378 path_to_goma: Path to goma directory. 372 path_to_goma: Path to goma directory.
379 path_to_extra_src: Path to extra source file. 373 path_to_extra_src: Path to extra source file.
380 dry_run: Do a dry run, skipping sync, build, and performance testing steps. 374 dry_run: Do a dry run, skipping sync, build, and performance testing steps.
381 375
382 Returns: 376 Returns:
383 An exit status code: 0 on success, otherwise 1. 377 An exit status code: 0 on success, otherwise 1.
384 """ 378 """
385 _PrintConfigStep(config) 379 _PrintConfigStep(config)
386 380
387 cmd = ['python', os.path.join(path_to_file, 'bisect-perf-regression.py'), 381 cmd = ['python', os.path.join(path_to_file, 'bisect-perf-regression.py'),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 452
459 if dry_run: 453 if dry_run:
460 cmd.extend(['--debug_ignore_build', '--debug_ignore_sync', 454 cmd.extend(['--debug_ignore_build', '--debug_ignore_sync',
461 '--debug_ignore_perf_test']) 455 '--debug_ignore_perf_test'])
462 cmd = [str(c) for c in cmd] 456 cmd = [str(c) for c in cmd]
463 457
464 with Goma(path_to_goma) as _: 458 with Goma(path_to_goma) as _:
465 return_code = subprocess.call(cmd) 459 return_code = subprocess.call(cmd)
466 460
467 if return_code: 461 if return_code:
468 print ('Error: bisect-perf-regression.py returned with error %d\n' 462 print ('Error: bisect_perf_regression.py returned with error %d\n'
469 % return_code) 463 % return_code)
470 464
471 return return_code 465 return return_code
472 466
473 467
474 def _PrintConfigStep(config): 468 def _PrintConfigStep(config):
475 """Prints out the given config, along with Buildbot annotations.""" 469 """Prints out the given config, along with Buildbot annotations."""
476 bisect_utils.OutputAnnotationStepStart('Config') 470 bisect_utils.OutputAnnotationStepStart('Config')
477 print 471 print
478 for k, v in config.iteritems(): 472 for k, v in config.iteritems():
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 config, current_dir, opts.path_to_goma) 560 config, current_dir, opts.path_to_goma)
567 561
568 print ('Error: Could not load config file. Double check your changes to ' 562 print ('Error: Could not load config file. Double check your changes to '
569 'auto_bisect/bisect.cfg or run-perf-test.cfg for syntax ' 563 'auto_bisect/bisect.cfg or run-perf-test.cfg for syntax '
570 'errors.\n') 564 'errors.\n')
571 return 1 565 return 1
572 566
573 567
574 if __name__ == '__main__': 568 if __name__ == '__main__':
575 sys.exit(main()) 569 sys.exit(main())
OLDNEW
« tools/auto_bisect/bisect_perf_regression.py ('K') | « tools/run-bisect-manual-test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698