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

Unified Diff: tools/bisect-builds.py

Issue 10939023: Adding gather_stats (based on bisect-builds.py) to gather benchmarking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gpu/gather_stats.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bisect-builds.py
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py
index 04b4689d4e42dd5935ff9fcb4b6b21bc11c7001f..3ccc2f03fec1de26a04da3d8fab6c820bb1ec859 100755
--- a/tools/bisect-builds.py
+++ b/tools/bisect-builds.py
@@ -182,7 +182,7 @@ class PathContext(object):
except ValueError:
pass
return (revisions, next_marker)
-
+
# Fetch the first list of revisions.
(revisions, next_marker) = _FetchAndParse(self.GetListingURL())
@@ -296,23 +296,31 @@ def FetchRevision(context, rev, filename, quit_event=None, progress_event=None):
pass
-def RunRevision(context, revision, zipfile, profile, num_runs, args):
- """Given a zipped revision, unzip it and run the test."""
+def RunRevision(context, revision, zipfile, num_runs, exec_args, outdir=None):
+ """Given a zipped revision, unzip it and run the test.
+ @param context A PathContext instance.
+ @param revision The Chromium revision number/tag to run.
+ @param zipfile Path to a zip file containing the Chromium revision.
+ @param num_runs Number of times to run the given Chromium revision.
+ @param exec_args Function which takes in the path of the unzipped Chromium
+ revision and returns the full command to execute Chromium.
+ @param outdir Path to save output to. If specified, stdout will be saved at
+ outdir/<revision>_<iteration>.out and stderr will be saved
+ at outdir/<revision>_<iteration>.err. If left as None, the
+ output is not saved.
+ """
print "Trying revision %s..." % str(revision)
- # Create a temp directory and unzip the revision into it.
- cwd = os.getcwd()
tempdir = tempfile.mkdtemp(prefix='bisect_tmp')
UnzipFilenameToDir(zipfile, tempdir)
- os.chdir(tempdir)
+ testargs = exec_args(os.path.join(tempdir, context.GetLaunchPath()))
- # Run the build as many times as specified.
- testargs = [context.GetLaunchPath(), '--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 == 'linux' or
context.platform == 'linux64'):
testargs.append('--no-sandbox')
+ # Run the build as many times as specified.
for i in range(0, num_runs):
subproc = subprocess.Popen(testargs,
bufsize=-1,
@@ -320,7 +328,19 @@ def RunRevision(context, revision, zipfile, profile, num_runs, args):
stderr=subprocess.PIPE)
(stdout, stderr) = subproc.communicate()
- os.chdir(cwd)
+ if outdir is not None:
+ if not os.path.isdir(outdir):
+ os.mkdir(outdir)
+
+ fout = open(os.path.join(outdir, '%s_%s.out' % (str(revision), str(i))),
+ 'w')
+ fout.write(stdout)
+ fout.close()
+ ferr = open(os.path.join(outdir, '%s_%s.err' % (str(revision), str(i))),
+ 'w')
+ ferr.write(stderr)
+ ferr.close()
+
try:
shutil.rmtree(tempdir, True)
except Exception, e:
@@ -471,6 +491,9 @@ def Bisect(platform,
_GetDownloadPath(up_rev))
up_fetch.Start()
+ def execute_args(chrome_path):
+ return [chrome_path, '--user-data-dir=%s' % profile] + try_args
+
# Run test on the pivot revision.
status = None
stdout = None
@@ -479,11 +502,11 @@ def Bisect(platform,
(status, stdout, stderr) = RunRevision(context,
rev,
zipfile,
- profile,
num_runs,
- try_args)
+ execute_args)
except Exception, e:
print >>sys.stderr, e
+
os.unlink(zipfile)
zipfile = None
« no previous file with comments | « no previous file | tools/gpu/gather_stats.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698