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

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') | tools/gpu/gather_stats.py » ('J')
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 8a02b25f45b816a6c46e69afe8b6aae8e825f6e5..40297f21fadf5ce633ec8a80b9b36e0e715168d5 100755
--- a/tools/bisect-builds.py
+++ b/tools/bisect-builds.py
@@ -300,23 +300,19 @@ 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, num_runs, testargs, tempdir,
+ outdir=None):
Ian Vollick 2012/09/18 17:46:32 Why is tempdir a parameter? It doesn't look like g
hartmanng 2012/09/19 02:17:55 Done.
"""Given a zipped revision, unzip it and run the test."""
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)
- # 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,
@@ -324,11 +320,18 @@ def RunRevision(context, revision, zipfile, profile, num_runs, args):
stderr=subprocess.PIPE)
(stdout, stderr) = subproc.communicate()
- os.chdir(cwd)
- try:
- shutil.rmtree(tempdir, True)
- except Exception, e:
- pass
+ 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()
Ian Vollick 2012/09/18 17:46:32 It looks like we shutil.rmtree after every call to
hartmanng 2012/09/19 02:17:55 Done.
return (subproc.returncode, stdout, stderr)
@@ -476,12 +479,20 @@ def Bisect(platform,
up_fetch.Start()
# Run test on the pivot revision.
+ tempdir = tempfile.mkdtemp(prefix='bisect_tmp')
+ testargs = [os.path.join(tempdir, context.GetLaunchPath()),
+ '--user-data-dir=%s' % profile] + try_args
(status, stdout, stderr) = RunRevision(context,
rev,
zipfile,
- profile,
num_runs,
- try_args)
+ testargs,
+ tempdir)
+ try:
+ shutil.rmtree(tempdir, True)
+ except Exception, e:
+ pass
+
os.unlink(zipfile)
zipfile = None
« no previous file with comments | « no previous file | tools/gpu/gather_stats.py » ('j') | tools/gpu/gather_stats.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698