diff options
author | vmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-19 22:14:34 +0000 |
---|---|---|
committer | vmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-19 22:14:34 +0000 |
commit | 4646a753f201b0b31497996cd2109e941829f6db (patch) | |
tree | 0be78e3abc824fdf4907704d92c9810a5a767ee6 /tools/bisect-builds.py | |
parent | 6676bf444b999c661a5289f1b33c0bcc04712d5c (diff) | |
download | chromium_src-4646a753f201b0b31497996cd2109e941829f6db.zip chromium_src-4646a753f201b0b31497996cd2109e941829f6db.tar.gz chromium_src-4646a753f201b0b31497996cd2109e941829f6db.tar.bz2 |
[tools] Add arbitrary command execution to bisect-builds
This should allow to bisect chrome via telemetry.
It adds an optional -c command that specifies how to
run chrome (%p refers to the executable, %a refers
to the arguments, and %s refers to all arguments as
a single parameter).
As an example, I used the following to bisect with
telemetry:
./tools/bisect-builds.py -a linux64 -g 210846 -c "/path/to/src/tools/perf/run_measurement --allow-live-sites --browser-executable=%p --browser=exact rasterize_and_record_benchmark /path/to/src/tools/perf/page_sets/top_25.json"
Note that any path specified has to be absolute,
since bisect builds actually switches directories.
Review URL: https://chromiumcodereview.appspot.com/18620008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/bisect-builds.py')
-rwxr-xr-x | tools/bisect-builds.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py index 356f03c..d9f3947 100755 --- a/tools/bisect-builds.py +++ b/tools/bisect-builds.py @@ -301,7 +301,7 @@ def FetchRevision(context, rev, filename, quit_event=None, progress_event=None): pass -def RunRevision(context, revision, zipfile, profile, num_runs, args): +def RunRevision(context, revision, zipfile, profile, num_runs, command, args): """Given a zipped revision, unzip it and run the test.""" print "Trying revision %s..." % str(revision) @@ -312,13 +312,22 @@ def RunRevision(context, revision, zipfile, profile, num_runs, args): os.chdir(tempdir) # Run the build as many times as specified. - testargs = [context.GetLaunchPath(), '--user-data-dir=%s' % profile] + args + testargs = ['--user-data-dir=%s' % profile] + args # The sandbox must be run as root on Official Chrome, so bypass it. if context.is_official and context.platform.startswith('linux'): testargs.append('--no-sandbox') + runcommand = [] + for token in command.split(): + if token == "%a": + runcommand.extend(testargs) + else: + runcommand.append( \ + token.replace('%p', context.GetLaunchPath()) \ + .replace('%s', ' '.join(testargs))) + for i in range(0, num_runs): - subproc = subprocess.Popen(testargs, + subproc = subprocess.Popen(runcommand, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -388,6 +397,7 @@ def Bisect(platform, good_rev=0, bad_rev=0, num_runs=1, + command="%p %a", try_args=(), profile=None, evaluate=AskIsGoodBuild): @@ -490,6 +500,7 @@ def Bisect(platform, fetch.zipfile, profile, num_runs, + command, try_args) except Exception, e: print >>sys.stderr, e @@ -632,6 +643,13 @@ def main(): help = 'Number of times to run each build before asking ' + 'if it\'s good or bad. Temporary profiles are reused.', default = 1) + parser.add_option('-c', '--command', type = 'str', + help = 'Command to execute. %p and %a refer to Chrome ' + + 'executable and specified extra arguments respectively. ' + + 'Use %s to specify all extra arguments as one string. ' + + 'Defaults to "%p %a". Note that any extra paths ' + + 'specified should be absolute.', + default = '%p %a'); (opts, args) = parser.parse_args() if opts.archive is None: @@ -670,8 +688,8 @@ def main(): return 1 (min_chromium_rev, max_chromium_rev) = Bisect( - opts.archive, opts.official_builds, good_rev, bad_rev, opts.times, args, - opts.profile) + opts.archive, opts.official_builds, good_rev, bad_rev, opts.times, + opts.command, args, opts.profile) # Get corresponding blink revisions. try: |