[email protected] | 477ca95 | 2013-02-26 23:00:49 | [diff] [blame] | 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 | """Prepare Performance Test Bisect Tool |
| 7 | |
| 8 | This script is used by a trybot to create a working directory and sync an |
| 9 | initial copy of the depot for use in bisecting performance regressions. |
| 10 | |
| 11 | An example usage: |
| 12 | |
| 13 | ./tools/prepare-bisect-perf-regressions.py --working_directory "~/builds" |
| 14 | --output_buildbot_annotations |
| 15 | |
| 16 | Would result in creating ~/builds/bisect and then populating it with a copy of |
| 17 | the depot. |
| 18 | |
| 19 | """ |
| 20 | |
| 21 | import optparse |
| 22 | import sys |
| 23 | |
| 24 | import bisect_utils |
| 25 | |
| 26 | |
| 27 | def main(): |
| 28 | |
| 29 | usage = ('%prog [options] [-- chromium-options]\n' |
| 30 | 'Prepares a temporary depot for use on a trybot.') |
| 31 | |
| 32 | parser = optparse.OptionParser(usage=usage) |
| 33 | |
| 34 | parser.add_option('-w', '--working_directory', |
| 35 | type='str', |
| 36 | help='Path to the working directory where the script will ' |
| 37 | 'do an initial checkout of the chromium depot. The ' |
| 38 | 'files will be placed in a subdirectory "bisect" under ' |
| 39 | 'working_directory and that will be used to perform the ' |
| 40 | 'bisection.') |
| 41 | parser.add_option('--output_buildbot_annotations', |
| 42 | action="store_true", |
| 43 | help='Add extra annotation output for buildbot.') |
[email protected] | bda7af4 | 2013-06-10 23:49:42 | [diff] [blame] | 44 | parser.add_option('--target_platform', |
| 45 | type='choice', |
| 46 | choices=['chromium', 'cros', 'android'], |
| 47 | default='chromium', |
| 48 | help='The target platform. Choices are "chromium" (current ' |
| 49 | 'platform), "cros", or "android". If you specify something ' |
| 50 | 'other than "chromium", you must be properly set up to ' |
| 51 | 'build that platform.') |
[email protected] | 477ca95 | 2013-02-26 23:00:49 | [diff] [blame] | 52 | (opts, args) = parser.parse_args() |
| 53 | |
| 54 | if not opts.working_directory: |
| 55 | print 'Error: missing required parameter: --working_directory' |
| 56 | print |
| 57 | parser.print_help() |
| 58 | return 1 |
| 59 | |
[email protected] | d6b47ab | 2013-08-29 16:25:35 | [diff] [blame] | 60 | if not bisect_utils.CheckIfBisectDepotExists(opts): |
[email protected] | e0e4381f | 2013-10-20 06:20:07 | [diff] [blame] | 61 | try: |
| 62 | bisect_utils.CreateBisectDirectoryAndSetupDepot(opts, |
| 63 | bisect_utils.DEFAULT_GCLIENT_CUSTOM_DEPS) |
| 64 | except RuntimeError: |
| 65 | return 1 |
[email protected] | d6b47ab | 2013-08-29 16:25:35 | [diff] [blame] | 66 | return 0 |
[email protected] | 477ca95 | 2013-02-26 23:00:49 | [diff] [blame] | 67 | |
| 68 | |
| 69 | if __name__ == '__main__': |
| 70 | sys.exit(main()) |